Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
b9643db1
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,发现更多精彩内容 >>
提交
b9643db1
编写于
5月 16, 2019
作者:
R
roo00
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加消息模块
上级
72ca7eac
变更
61
隐藏空白更改
内联
并排
Showing
61 changed file
with
1704 addition
and
809 deletion
+1704
-809
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
+3
-1
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/ActionEraseDocumentWithAppInfo.java
...control/jaxrs/appinfo/ActionEraseDocumentWithAppInfo.java
+2
-2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionEraseDocumentWithCategory.java
...l/jaxrs/categoryinfo/ActionEraseDocumentWithCategory.java
+2
-2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionListDraftNextWithFilter.java
...control/jaxrs/document/ActionListDraftNextWithFilter.java
+7
-7
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/service/DocumentInfoServiceAdv.java
.../cms/assemble/control/service/DocumentInfoServiceAdv.java
+3
-3
o2server/x_component_assemble_control/src/main/webapp/jest/describe.js
...mponent_assemble_control/src/main/webapp/jest/describe.js
+17
-5
o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java
...le/src/main/java/com/x/server/console/CommandFactory.java
+4
-4
o2server/x_console/src/main/java/com/x/server/console/Main.java
...er/x_console/src/main/java/com/x/server/console/Main.java
+17
-17
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java
.../java/com/x/server/console/server/web/WebServerTools.java
+1
-1
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java
...ain/java/com/x/file/assemble/control/ThisApplication.java
+2
-5
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/attachment/ActionUpdate.java
.../file/assemble/control/jaxrs/attachment/ActionUpdate.java
+4
-7
o2server/x_file_assemble_control/src/main/webapp/jest/describe.js
.../x_file_assemble_control/src/main/webapp/jest/describe.js
+17
-5
o2server/x_general_assemble_control/src/main/webapp/jest/describe.js
...general_assemble_control/src/main/webapp/jest/describe.js
+17
-5
o2server/x_hotpic_assemble_control/src/main/webapp/jest/describe.js
..._hotpic_assemble_control/src/main/webapp/jest/describe.js
+17
-5
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java
.../java/com/x/meeting/assemble/control/ThisApplication.java
+1
-3
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/attachment/ActionListWithMeeting.java
...emble/control/jaxrs/attachment/ActionListWithMeeting.java
+0
-2
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/meeting/ActionAccept.java
.../meeting/assemble/control/jaxrs/meeting/ActionAccept.java
+0
-1
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/meeting/BaseAction.java
.../x/meeting/assemble/control/jaxrs/meeting/BaseAction.java
+12
-17
o2server/x_meeting_assemble_control/src/main/webapp/jest/describe.js
...meeting_assemble_control/src/main/webapp/jest/describe.js
+17
-5
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/CalendarConsumeQueue.java
.../x/message/assemble/communicate/CalendarConsumeQueue.java
+1
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/DingdingConsumeQueue.java
.../x/message/assemble/communicate/DingdingConsumeQueue.java
+1
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/PmsConsumeQueue.java
...a/com/x/message/assemble/communicate/PmsConsumeQueue.java
+38
-9
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/QiyeweixinConsumeQueue.java
.../message/assemble/communicate/QiyeweixinConsumeQueue.java
+1
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java
...a/com/x/message/assemble/communicate/ThisApplication.java
+11
-3
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/WsConsumeQueue.java
...va/com/x/message/assemble/communicate/WsConsumeQueue.java
+58
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ZhengwuDingdingConsumeQueue.java
...age/assemble/communicate/ZhengwuDingdingConsumeQueue.java
+1
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ActionApplication.java
...message/assemble/communicate/jaxrs/ActionApplication.java
+4
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/InstantJaxrsFilter.java
...essage/assemble/communicate/jaxrs/InstantJaxrsFilter.java
+10
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/WsJaxrsFilter.java
...m/x/message/assemble/communicate/jaxrs/WsJaxrsFilter.java
+2
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/connector/ActionCreate.java
...ge/assemble/communicate/jaxrs/connector/ActionCreate.java
+79
-345
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionList.java
...essage/assemble/communicate/jaxrs/consume/ActionList.java
+2
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithCurrentPerson.java
...ommunicate/jaxrs/consume/ActionListWithCurrentPerson.java
+2
-4
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithPerson.java
...emble/communicate/jaxrs/consume/ActionListWithPerson.java
+2
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumed.java
...ommunicate/jaxrs/instant/ActionCurrentPersonConsumed.java
+64
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
...unicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
+41
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListNext.java
...ge/assemble/communicate/jaxrs/instant/ActionListNext.java
+53
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListPrev.java
...ge/assemble/communicate/jaxrs/instant/ActionListPrev.java
+53
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
...unicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
+60
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
...jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
+61
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedDesc.java
...axrs/instant/ActionListWithCurrentPersonConsumedDesc.java
+61
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
...nicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
+60
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
...rs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
+61
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedDesc.java
...s/instant/ActionListWithCurrentPersonNotConsumedDesc.java
+61
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/BaseAction.java
...essage/assemble/communicate/jaxrs/instant/BaseAction.java
+7
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/InstantAction.java
...age/assemble/communicate/jaxrs/instant/InstantAction.java
+216
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ws/ActionCreate.java
...x/message/assemble/communicate/jaxrs/ws/ActionCreate.java
+4
-4
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ws/BaseAction.java
...m/x/message/assemble/communicate/jaxrs/ws/BaseAction.java
+1
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ws/WsAction.java
...com/x/message/assemble/communicate/jaxrs/ws/WsAction.java
+6
-6
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java
...va/com/x/message/assemble/communicate/schedule/Clean.java
+103
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/CleanConnections.java
...ssage/assemble/communicate/schedule/CleanConnections.java
+41
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/ActionCollaboration.java
...ble/communicate/ws/collaboration/ActionCollaboration.java
+52
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/CollaborationAction.java
...ble/communicate/ws/collaboration/CollaborationAction.java
+0
-183
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/WsConfigurator.java
...assemble/communicate/ws/collaboration/WsConfigurator.java
+2
-1
o2server/x_message_assemble_communicate/src/main/webapp/jest/describe.js
...age_assemble_communicate/src/main/webapp/jest/describe.js
+17
-5
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java
...tity/src/main/java/com/x/message/core/entity/Instant.java
+158
-0
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Message.java
...tity/src/main/java/com/x/message/core/entity/Message.java
+39
-27
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/PersistenceProperties.java
...java/com/x/message/core/entity/PersistenceProperties.java
+4
-0
o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java
...main/java/com/x/okr/assemble/control/ThisApplication.java
+8
-12
o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/service/OkrSendNotifyService.java
.../x/okr/assemble/control/service/OkrSendNotifyService.java
+94
-95
o2server/x_okr_assemble_control/src/main/webapp/jest/describe.js
...r/x_okr_assemble_control/src/main/webapp/jest/describe.js
+17
-5
未找到文件。
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/factory/DocumentFactory.java
浏览文件 @
b9643db1
...
...
@@ -432,7 +432,9 @@ public class DocumentFactory<T> extends AbstractFactory {
Root
<
Document
>
root
=
cq
.
from
(
Document
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Document_
.
creatorPerson
),
name
);
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Document_
.
docStatus
),
"draft"
));
p
=
cb
.
and
(
p
,
root
.
get
(
Document_
.
categoryId
).
in
(
categoryIdList
));
if
(
ListTools
.
isNotEmpty
(
categoryIdList
))
{
p
=
cb
.
and
(
p
,
root
.
get
(
Document_
.
categoryId
).
in
(
categoryIdList
));
}
if
(
StringUtils
.
isNotEmpty
(
documentType
)
&&
!
"全部"
.
equals
(
documentType
))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Document_
.
documentType
),
documentType
));
}
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/appinfo/ActionEraseDocumentWithAppInfo.java
浏览文件 @
b9643db1
...
...
@@ -59,7 +59,7 @@ public class ActionEraseDocumentWithAppInfo extends BaseAction {
List
<
String
>
idsForDelete
=
null
;
List
<
String
>
allFileInfoIds
=
null
;
Document
document
=
null
;
Integer
queryMaxCount
=
50
00
;
Integer
queryMaxCount
=
1
00
;
Integer
whileCount
=
0
;
Integer
currentWhileCount
=
0
;
FileInfo
fileInfo
=
null
;
...
...
@@ -75,7 +75,7 @@ public class ActionEraseDocumentWithAppInfo extends BaseAction {
//循环清除分类下所有的文档信息
while
(
count
>
0
&&
currentWhileCount
<=
whileCount
)
{
logger
.
info
(
">>>>正在根据appId查询"
+
c
ount
+
"个需要删除的文档ID列表。"
);
logger
.
info
(
">>>>正在根据appId查询"
+
queryMaxC
ount
+
"个需要删除的文档ID列表。"
);
idsForDelete
=
documentServiceAdv
.
listIdsByAppId
(
id
,
null
,
queryMaxCount
);
if
(
ListTools
.
isNotEmpty
(
idsForDelete
))
{
emc
.
beginTransaction
(
Document
.
class
);
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/categoryinfo/ActionEraseDocumentWithCategory.java
浏览文件 @
b9643db1
...
...
@@ -60,7 +60,7 @@ public class ActionEraseDocumentWithCategory extends BaseAction {
Document
document
=
null
;
List
<
String
>
idsForDelete
=
null
;
List
<
String
>
allFileInfoIds
=
null
;
Integer
queryMaxCount
=
50
00
;
Integer
queryMaxCount
=
1
00
;
Integer
whileCount
=
0
;
Integer
currentWhileCount
=
0
;
FileInfo
fileInfo
=
null
;
...
...
@@ -76,7 +76,7 @@ public class ActionEraseDocumentWithCategory extends BaseAction {
//循环清除分类下所有的文档信息
while
(
count
>
0
&&
currentWhileCount
<=
whileCount
)
{
logger
.
info
(
">>>>正在根据categoryId查询"
+
c
ount
+
"个需要删除的文档ID列表。"
);
logger
.
info
(
">>>>正在根据categoryId查询"
+
queryMaxC
ount
+
"个需要删除的文档ID列表。"
);
idsForDelete
=
documentServiceAdv
.
listIdsByCategoryId
(
id
,
queryMaxCount
);
if
(
ListTools
.
isNotEmpty
(
idsForDelete
))
{
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/document/ActionListDraftNextWithFilter.java
浏览文件 @
b9643db1
...
...
@@ -49,13 +49,13 @@ public class ActionListDraftNextWithFilter extends BaseAction {
wos
=
(
List
<
Wo
>)
element
.
getObjectValue
();
result
.
setData
(
wos
);
}
else
{
if
(
check
)
{
if
(
wi
.
getCategoryIdList
()
==
null
||
wi
.
getCategoryIdList
().
isEmpty
())
{
check
=
false
;
Exception
exception
=
new
ExceptionDocumentCategoryIdEmpty
();
result
.
error
(
exception
);
}
}
//
if (check) {
//
if (wi.getCategoryIdList() == null || wi.getCategoryIdList().isEmpty()) {
//
check = false;
//
Exception exception = new ExceptionDocumentCategoryIdEmpty();
//
result.error(exception);
//
}
//
}
if
(
check
)
{
try
{
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoService.java
浏览文件 @
b9643db1
...
...
@@ -80,6 +80,11 @@ public class DocumentInfoService {
document
=
emc
.
find
(
wrapIn
.
getId
(),
Document
.
class
);
emc
.
beginTransaction
(
Document
.
class
);
emc
.
beginTransaction
(
Log
.
class
);
if
(
wrapIn
.
getTitle
()
!=
null
&&
wrapIn
.
getTitle
().
length
()
>
70
)
{
wrapIn
.
setTitle
(
wrapIn
.
getTitle
().
substring
(
0
,
70
)
);
}
if
(
document
==
null
){
document
=
new
Document
();
wrapIn
.
copyTo
(
document
);
...
...
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/service/DocumentInfoServiceAdv.java
浏览文件 @
b9643db1
...
...
@@ -257,9 +257,9 @@ public class DocumentInfoServiceAdv {
if
(
name
==
null
||
name
.
isEmpty
()){
throw
new
Exception
(
"name is null!"
);
}
if
(
categoryIdList
==
null
||
categoryIdList
.
isEmpty
()
){
throw
new
Exception
(
"categoryIdList is null!"
);
}
//
if( categoryIdList == null || categoryIdList.isEmpty() ){
//
throw new Exception("categoryIdList is null!");
//
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
()
)
{
return
documentInfoService
.
listMyDraft
(
emc
,
name
,
categoryIdList
,
documentType
);
}
catch
(
Exception
e
)
{
...
...
o2server/x_component_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_console/src/main/java/com/x/server/console/CommandFactory.java
浏览文件 @
b9643db1
...
...
@@ -37,8 +37,8 @@ public class CommandFactory {
public
static
final
Pattern
exit_pattern
=
Pattern
.
compile
(
"^ {0,}exit {0,}$"
,
Pattern
.
CASE_INSENSITIVE
);
public
static
final
Pattern
update_pattern
=
Pattern
.
compile
(
"^ {0,}update (true|false) (true|false) (.+)$"
,
Pattern
.
CASE_INSENSITIVE
);
//
public static final Pattern update_pattern = Pattern.compile("^ {0,}update (true|false) (true|false) (.+)$",
//
Pattern.CASE_INSENSITIVE);
public
static
final
Pattern
updateFile_pattern
=
Pattern
.
compile
(
"^ {0,}update file (.+) (true|false) (.+)$"
,
Pattern
.
CASE_INSENSITIVE
);
...
...
@@ -114,8 +114,8 @@ public class CommandFactory {
help
+=
" restore storage yyyyMMddHHmmss (passwd)"
+
"\t\t"
+
"restore storage to database,file."
;
help
+=
StringUtils
.
LF
;
help
+=
" setPassword (oldpasswd) (newpasswd)"
+
"\t\t\t"
+
"change initial manager password."
;
help
+=
StringUtils
.
LF
;
help
+=
" update (backup) (latest) (passwd)"
+
"\t\t\t"
+
"upgrade to new version."
;
//
help += StringUtils.LF;
//
help += " update (backup) (latest) (passwd)" + "\t\t\t" + "upgrade to new version.";
help
+=
StringUtils
.
LF
;
help
+=
" update file (path) (backup) (passwd)"
+
"\t\t\t"
+
"upgrade to new version from local zip file."
;
help
+=
StringUtils
.
LF
;
...
...
o2server/x_console/src/main/java/com/x/server/console/Main.java
浏览文件 @
b9643db1
...
...
@@ -273,15 +273,15 @@ public class Main {
continue
;
}
matcher
=
CommandFactory
.
update_pattern
.
matcher
(
cmd
);
if
(
matcher
.
find
())
{
if
(
update
(
matcher
.
group
(
1
),
matcher
.
group
(
2
),
matcher
.
group
(
3
)))
{
stopAll
();
System
.
exit
(
0
);
}
else
{
continue
;
}
}
//
matcher = CommandFactory.update_pattern.matcher(cmd);
//
if (matcher.find()) {
//
if (update(matcher.group(1), matcher.group(2), matcher.group(3))) {
//
stopAll();
//
System.exit(0);
//
} else {
//
continue;
//
}
//
}
matcher
=
CommandFactory
.
updateFile_pattern
.
matcher
(
cmd
);
if
(
matcher
.
find
())
{
...
...
@@ -418,14 +418,14 @@ public class Main {
return
true
;
}
private
static
boolean
update
(
String
password
,
String
backup
,
String
latest
)
{
try
{
return
new
ActionUpdate
().
execute
(
password
,
BooleanUtils
.
toBoolean
(
backup
),
BooleanUtils
.
toBoolean
(
latest
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
true
;
}
//
private static boolean update(String password, String backup, String latest) {
//
try {
//
return new ActionUpdate().execute(password, BooleanUtils.toBoolean(backup), BooleanUtils.toBoolean(latest));
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
return true;
//
}
private
static
boolean
updateFile
(
String
path
,
String
backup
,
String
password
)
{
try
{
...
...
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java
浏览文件 @
b9643db1
...
...
@@ -63,7 +63,7 @@ public class WebServerTools extends JettySeverTools {
context
.
setDefaultsDescriptor
(
new
File
(
Config
.
base
(),
"commons/webdefault_w.xml"
).
getAbsolutePath
());
// context.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer",
// "false");
context
.
setWelcomeFiles
(
new
String
[]
{
"index.html"
});
context
.
setWelcomeFiles
(
new
String
[]
{
"
default.html"
,
"
index.html"
});
context
.
setGzipHandler
(
new
GzipHandler
());
context
.
setParentLoaderPriority
(
true
);
server
.
setHandler
(
context
);
...
...
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java
浏览文件 @
b9643db1
...
...
@@ -3,15 +3,12 @@ package com.x.file.assemble.control;
import
com.x.base.core.project.Context
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.collaboration.core.message.Collaboration
;
import
com.x.file.assemble.control.jaxrs.file.FileRemoveQueue
;
public
class
ThisApplication
{
public
static
FileRemoveQueue
fileRemoveQueue
;
public
static
Collaboration
collaboration
;
protected
static
Context
context
;
public
static
Context
context
()
{
...
...
@@ -23,7 +20,7 @@ public class ThisApplication {
LoggerFactory
.
setLevel
(
Config
.
logLevel
().
x_file_assemble_control
());
fileRemoveQueue
=
new
FileRemoveQueue
();
context
().
startQueue
(
fileRemoveQueue
);
Collaboration
.
start
(
context
());
//
Collaboration.start(context());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -31,7 +28,7 @@ public class ThisApplication {
public
static
void
destroy
()
{
try
{
Collaboration
.
stop
();
//
Collaboration.stop();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/attachment/ActionUpdate.java
浏览文件 @
b9643db1
...
...
@@ -19,9 +19,6 @@ import com.x.base.core.project.http.ActionResult;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.collaboration.core.message.Collaboration
;
import
com.x.collaboration.core.message.notification.FileModifyMessage
;
import
com.x.collaboration.core.message.notification.FileShareMessage
;
import
com.x.file.assemble.control.Business
;
import
com.x.file.core.entity.personal.Attachment
;
...
...
@@ -67,14 +64,14 @@ class ActionUpdate extends BaseAction {
/* 发送共享通知 */
for
(
String
str
:
shareAdds
)
{
this
.
message_send_attachment_share
(
attachment
,
str
);
FileShareMessage
message
=
new
FileShareMessage
(
str
,
attachment
.
getId
());
Collaboration
.
send
(
message
);
//
FileShareMessage message = new FileShareMessage(str, attachment.getId());
//
Collaboration.send(message);
}
/* 发送编辑通知 */
for
(
String
str
:
editorAdds
)
{
this
.
message_send_attachment_editor
(
attachment
,
str
);
FileModifyMessage
message
=
new
FileModifyMessage
(
str
,
attachment
.
getId
());
Collaboration
.
send
(
message
);
//
FileModifyMessage message = new FileModifyMessage(str, attachment.getId());
//
Collaboration.send(message);
}
/* 发送取消共享通知 */
for
(
String
str
:
shareCancels
)
{
...
...
o2server/x_file_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_general_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_hotpic_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/ThisApplication.java
浏览文件 @
b9643db1
...
...
@@ -4,7 +4,6 @@ import com.x.base.core.project.Context;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.MessageConnector
;
import
com.x.collaboration.core.message.Collaboration
;
public
class
ThisApplication
{
...
...
@@ -18,7 +17,6 @@ public class ThisApplication {
try
{
LoggerFactory
.
setLevel
(
Config
.
logLevel
().
x_meeting_assemble_control
());
MessageConnector
.
start
(
context
());
Collaboration
.
start
(
context
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -26,7 +24,7 @@ public class ThisApplication {
public
static
void
destroy
()
{
try
{
Collaboration
.
stop
();
MessageConnector
.
stop
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/attachment/ActionListWithMeeting.java
浏览文件 @
b9643db1
...
...
@@ -12,8 +12,6 @@ import com.x.base.core.project.http.ActionResult;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.tools.SortTools
;
import
com.x.meeting.assemble.control.Business
;
import
com.x.meeting.assemble.control.WrapTools
;
import
com.x.meeting.assemble.control.wrapout.WrapOutAttachment
;
import
com.x.meeting.core.entity.Attachment
;
import
com.x.meeting.core.entity.Meeting
;
...
...
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/meeting/ActionAccept.java
浏览文件 @
b9643db1
...
...
@@ -30,7 +30,6 @@ class ActionAccept extends BaseAction {
emc
.
check
(
meeting
,
CheckPersistType
.
all
);
emc
.
commit
();
MessageFactory
.
meeting_accept
(
effectivePerson
.
getDistinguishedName
(),
meeting
);
// this.notifyMeetingAcceptMessage(business, meeting, meeting.getApplicant());
}
Wo
wo
=
new
Wo
();
wo
.
setId
(
meeting
.
getId
());
...
...
o2server/x_meeting_assemble_control/src/main/java/com/x/meeting/assemble/control/jaxrs/meeting/BaseAction.java
浏览文件 @
b9643db1
...
...
@@ -10,11 +10,6 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.base.core.project.organization.OrganizationDefinition.DistinguishedNameCategory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.collaboration.core.message.Collaboration
;
import
com.x.collaboration.core.message.notification.MeetingAcceptMessage
;
import
com.x.collaboration.core.message.notification.MeetingCancelMessage
;
import
com.x.collaboration.core.message.notification.MeetingInviteMessage
;
import
com.x.collaboration.core.message.notification.MeetingRejectMessage
;
import
com.x.meeting.assemble.control.Business
;
import
com.x.meeting.core.entity.Building
;
import
com.x.meeting.core.entity.Meeting
;
...
...
@@ -31,9 +26,9 @@ abstract class BaseAction extends StandardJaxrsAction {
ExceptionWhen
.
not_found
);
for
(
String
str
:
ListTools
.
nullToEmpty
(
meeting
.
getInvitePersonList
()))
{
logger
.
debug
(
"send old meeting invite message to:{}, message body:{}"
,
str
,
meeting
);
MeetingInviteMessage
message
=
new
MeetingInviteMessage
(
str
,
building
.
getId
(),
room
.
getId
(),
meeting
.
getId
());
Collaboration
.
send
(
message
);
//
MeetingInviteMessage message = new MeetingInviteMessage(str, building.getId(), room.getId(),
//
meeting.getId());
//
Collaboration.send(message);
}
}
}
...
...
@@ -49,9 +44,9 @@ abstract class BaseAction extends StandardJaxrsAction {
// "会议室:" + room.getName() + ",会议地点:" + building.getName() +
// building.getAddress() + ".",
// "meetingReject");
MeetingCancelMessage
message
=
new
MeetingCancelMessage
(
str
,
building
.
getId
(),
room
.
getId
(),
meeting
.
getId
());
Collaboration
.
send
(
message
);
//
MeetingCancelMessage message = new MeetingCancelMessage(str, building.getId(), room.getId(),
//
meeting.getId());
//
Collaboration.send(message);
}
}
}
...
...
@@ -66,9 +61,9 @@ abstract class BaseAction extends StandardJaxrsAction {
// "会议室:" + room.getName() + ",会议地点:" + building.getName() +
// building.getAddress() + ".",
// "meetingAccept");
MeetingAcceptMessage
message
=
new
MeetingAcceptMessage
(
str
,
building
.
getId
(),
room
.
getId
(),
meeting
.
getId
());
Collaboration
.
send
(
message
);
//
MeetingAcceptMessage message = new MeetingAcceptMessage(str, building.getId(), room.getId(),
//
meeting.getId());
//
Collaboration.send(message);
}
}
...
...
@@ -78,9 +73,9 @@ abstract class BaseAction extends StandardJaxrsAction {
Building
building
=
business
.
entityManagerContainer
().
find
(
room
.
getBuilding
(),
Building
.
class
,
ExceptionWhen
.
not_found
);
for
(
String
str
:
ListTools
.
trim
(
meeting
.
getInvitePersonList
(),
true
,
true
,
meeting
.
getApplicant
()))
{
MeetingRejectMessage
message
=
new
MeetingRejectMessage
(
str
,
building
.
getId
(),
room
.
getId
(),
meeting
.
getId
());
Collaboration
.
send
(
message
);
//
MeetingRejectMessage message = new MeetingRejectMessage(str, building.getId(), room.getId(),
//
meeting.getId());
//
Collaboration.send(message);
}
}
...
...
o2server/x_meeting_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/CalendarConsumeQueue.java
浏览文件 @
b9643db1
...
...
@@ -23,7 +23,7 @@ public class CalendarConsumeQueue extends AbstractQueue<Message> {
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
emc
.
remove
(
messageEntityObject
);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/DingdingConsumeQueue.java
浏览文件 @
b9643db1
...
...
@@ -36,7 +36,7 @@ public class DingdingConsumeQueue extends AbstractQueue<Message> {
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
emc
.
remove
(
messageEntityObject
);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/PmsConsumeQueue.java
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate
;
import
org.apache.commons.lang3.BooleanUtils
;
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.project.config.Config
;
import
com.x.base.core.project.connection.CipherConnectionAction
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.MessageConnector
;
import
com.x.base.core.project.message.PmsMessage
;
import
com.x.base.core.project.organization.Person
;
...
...
@@ -14,17 +20,40 @@ import com.x.message.core.entity.Message;
public
class
PmsConsumeQueue
extends
AbstractQueue
<
Message
>
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
PmsConsumeQueue
.
class
);
private
static
final
String
TASK_FIRST
=
"first"
;
protected
void
execute
(
Message
message
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Person
person
=
business
.
organization
().
person
().
getObject
(
message
.
getPerson
());
if
((
null
!=
person
)
&&
StringUtils
.
isNotEmpty
(
person
.
getMobile
()))
{
PmsMessage
pms
=
new
PmsMessage
();
pms
.
setAccount
(
person
.
getMobile
());
pms
.
setTitle
(
message
.
getTitle
());
pms
.
setText
(
message
.
getTitle
());
String
url
=
Config
.
x_program_centerUrlRoot
()
+
MessageConnector
.
CONSUME_PMS
;
CipherConnectionAction
.
post
(
false
,
url
,
pms
);
logger
.
debug
(
"send pms message:{}."
,
message
);
Boolean
result
=
false
;
JsonElement
jsonElement
=
XGsonBuilder
.
instance
().
fromJson
(
message
.
getBody
(),
JsonElement
.
class
);
/* 跳过第一条待办的提醒 */
if
(
StringUtils
.
equalsIgnoreCase
(
message
.
getType
(),
MessageConnector
.
TYPE_TASK_CREATE
)
&&
BooleanUtils
.
isTrue
(
XGsonBuilder
.
extractBoolean
(
jsonElement
,
TASK_FIRST
)))
{
logger
.
debug
(
"跳过一条pms待办提醒:{}."
,
message
);
result
=
true
;
}
else
{
Business
business
=
new
Business
(
emc
);
Person
person
=
business
.
organization
().
person
().
getObject
(
message
.
getPerson
());
if
((
null
!=
person
)
&&
StringUtils
.
isNotEmpty
(
person
.
getMobile
()))
{
PmsMessage
pms
=
new
PmsMessage
();
pms
.
setAccount
(
person
.
getMobile
());
pms
.
setTitle
(
message
.
getTitle
());
pms
.
setText
(
message
.
getTitle
());
String
url
=
Config
.
x_program_centerUrlRoot
()
+
MessageConnector
.
CONSUME_PMS
;
WrapBoolean
wrapBoolean
=
CipherConnectionAction
.
post
(
false
,
url
,
pms
).
getData
(
WrapBoolean
.
class
);
result
=
wrapBoolean
.
getValue
();
}
}
if
(
BooleanUtils
.
isTrue
(
result
))
{
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
}
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/QiyeweixinConsumeQueue.java
浏览文件 @
b9643db1
...
...
@@ -34,7 +34,7 @@ public class QiyeweixinConsumeQueue extends AbstractQueue<Message> {
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
emc
.
remove
(
messageEntityObject
);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ThisApplication.java
浏览文件 @
b9643db1
...
...
@@ -8,12 +8,15 @@ import org.apache.commons.lang3.BooleanUtils;
import
com.x.base.core.project.Context
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.schedule.Clean
;
import
com.x.message.assemble.communicate.schedule.CleanConnections
;
public
class
ThisApplication
{
protected
static
Context
context
;
public
static
ImConsumeQueue
imConsumeQueue
=
new
Im
ConsumeQueue
();
public
static
WsConsumeQueue
wsConsumeQueue
=
new
Ws
ConsumeQueue
();
public
static
PmsConsumeQueue
pmsConsumeQueue
=
new
PmsConsumeQueue
();
...
...
@@ -33,7 +36,8 @@ public class ThisApplication {
public
static
void
init
()
{
try
{
imConsumeQueue
.
start
();
LoggerFactory
.
setLevel
(
Config
.
logLevel
().
x_message_assemble_communicate
());
wsConsumeQueue
.
start
();
pmsConsumeQueue
.
start
();
calendarConsumeQueue
.
start
();
if
(
BooleanUtils
.
isTrue
(
Config
.
qiyeweixin
().
getEnable
())
...
...
@@ -48,6 +52,10 @@ public class ThisApplication {
&&
BooleanUtils
.
isTrue
(
Config
.
dingding
().
getMessageEnable
()))
{
dingdingConsumeQueue
.
start
();
}
if
(
BooleanUtils
.
isTrue
(
Config
.
messages
().
clean
().
getEnable
()))
{
context
().
schedule
(
Clean
.
class
,
Config
.
messages
().
clean
().
getCron
());
}
context
().
scheduleLocal
(
CleanConnections
.
class
,
180
,
900
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -55,7 +63,7 @@ public class ThisApplication {
public
static
void
destroy
()
{
try
{
im
ConsumeQueue
.
stop
();
ws
ConsumeQueue
.
stop
();
pmsConsumeQueue
.
stop
();
calendarConsumeQueue
.
stop
();
if
(
BooleanUtils
.
isTrue
(
Config
.
qiyeweixin
().
getEnable
())
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/
Im
ConsumeQueue.java
→
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/
Ws
ConsumeQueue.java
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate
;
import
org.apache.commons.lang3.BooleanUtils
;
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
;
...
...
@@ -7,31 +10,46 @@ import com.x.base.core.project.Application;
import
com.x.base.core.project.x_message_assemble_communicate
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.message.ImMessage
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.MessageConnector
;
import
com.x.base.core.project.message.WsMessage
;
import
com.x.base.core.project.queue.AbstractQueue
;
import
com.x.message.core.entity.Message
;
public
class
ImConsumeQueue
extends
AbstractQueue
<
Message
>
{
public
class
WsConsumeQueue
extends
AbstractQueue
<
Message
>
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
WsConsumeQueue
.
class
);
private
static
final
String
TASK_FIRST
=
"first"
;
protected
void
execute
(
Message
message
)
throws
Exception
{
ImMessage
im
=
new
ImMessage
();
im
.
setType
(
message
.
getType
());
im
.
setPerson
(
message
.
getPerson
());
im
.
setTitle
(
message
.
getTitle
());
im
.
setBody
(
XGsonBuilder
.
instance
().
fromJson
(
message
.
getBody
(),
JsonElement
.
class
));
// logger.debug("send ws message:{}.", message);
WsMessage
ws
=
new
WsMessage
();
ws
.
setType
(
message
.
getType
());
ws
.
setPerson
(
message
.
getPerson
());
ws
.
setTitle
(
message
.
getTitle
());
JsonElement
jsonElement
=
XGsonBuilder
.
instance
().
fromJson
(
message
.
getBody
(),
JsonElement
.
class
);
ws
.
setBody
(
jsonElement
);
Boolean
result
=
false
;
for
(
Application
app
:
ThisApplication
.
context
().
applications
().
get
(
x_message_assemble_communicate
.
class
))
{
WrapBoolean
wrapBoolean
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
app
,
MessageConnector
.
CONSUME_IM
,
im
).
getData
(
WrapBoolean
.
class
);
result
=
result
||
wrapBoolean
.
getValue
();
/* 跳过第一条待办的提醒 */
if
(
StringUtils
.
equalsIgnoreCase
(
ws
.
getType
(),
MessageConnector
.
TYPE_TASK_CREATE
)
&&
BooleanUtils
.
isTrue
(
XGsonBuilder
.
extractBoolean
(
jsonElement
,
TASK_FIRST
)))
{
//logger.debug("跳过一条ws待办提醒:{}.", ws);
result
=
true
;
}
else
{
for
(
Application
app
:
ThisApplication
.
context
().
applications
().
get
(
x_message_assemble_communicate
.
class
))
{
WrapBoolean
wrapBoolean
=
ThisApplication
.
context
().
applications
()
.
postQuery
(
app
,
MessageConnector
.
CONSUME_WS
,
ws
).
getData
(
WrapBoolean
.
class
);
result
=
result
||
wrapBoolean
.
getValue
();
}
}
if
(
result
)
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
emc
.
remove
(
messageEntityObject
);
messageEntityObject
.
setConsumed
(
true
);
emc
.
commit
();
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ZhengwuDingdingConsumeQueue.java
浏览文件 @
b9643db1
...
...
@@ -35,7 +35,7 @@ public class ZhengwuDingdingConsumeQueue extends AbstractQueue<Message> {
Message
messageEntityObject
=
emc
.
find
(
message
.
getId
(),
Message
.
class
);
if
(
null
!=
messageEntityObject
)
{
emc
.
beginTransaction
(
Message
.
class
);
emc
.
remove
(
messageEntityObject
);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ActionApplication.java
浏览文件 @
b9643db1
...
...
@@ -7,19 +7,21 @@ import javax.ws.rs.ApplicationPath;
import
com.x.base.core.project.jaxrs.AbstractActionApplication
;
import
com.x.message.assemble.communicate.jaxrs.connector.ConnectorAction
;
import
com.x.message.assemble.communicate.jaxrs.consume.ConsumeAction
;
import
com.x.message.assemble.communicate.jaxrs.i
m.Im
Action
;
import
com.x.message.assemble.communicate.jaxrs.i
nstant.Instant
Action
;
import
com.x.message.assemble.communicate.jaxrs.mass.MassAction
;
import
com.x.message.assemble.communicate.jaxrs.message.MessageAction
;
import
com.x.message.assemble.communicate.jaxrs.ws.WsAction
;
@ApplicationPath
(
"jaxrs"
)
public
class
ActionApplication
extends
AbstractActionApplication
{
public
Set
<
Class
<?>>
getClasses
()
{
classes
.
add
(
ConnectorAction
.
class
);
classes
.
add
(
Im
Action
.
class
);
classes
.
add
(
Ws
Action
.
class
);
classes
.
add
(
ConsumeAction
.
class
);
classes
.
add
(
MassAction
.
class
);
classes
.
add
(
MessageAction
.
class
);
classes
.
add
(
InstantAction
.
class
);
return
classes
;
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/InstantJaxrsFilter.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs
;
import
javax.servlet.annotation.WebFilter
;
import
com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter
;
@WebFilter
(
urlPatterns
=
"/jaxrs/instant/*"
,
asyncSupported
=
true
)
public
class
InstantJaxrsFilter
extends
CipherManagerUserJaxrsFilter
{
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
Im
JaxrsFilter.java
→
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
Ws
JaxrsFilter.java
浏览文件 @
b9643db1
...
...
@@ -4,7 +4,7 @@ import javax.servlet.annotation.WebFilter;
import
com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter
;
@WebFilter
(
urlPatterns
=
"/jaxrs/
im
/*"
,
asyncSupported
=
true
)
public
class
Im
JaxrsFilter
extends
CipherManagerUserJaxrsFilter
{
@WebFilter
(
urlPatterns
=
"/jaxrs/
ws
/*"
,
asyncSupported
=
true
)
public
class
Ws
JaxrsFilter
extends
CipherManagerUserJaxrsFilter
{
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/connector/ActionCreate.java
浏览文件 @
b9643db1
...
...
@@ -9,6 +9,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.gson.XGsonBuilder
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -18,6 +19,7 @@ import com.x.base.core.project.message.MessageConnector;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.assemble.communicate.ThisApplication
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Message
;
class
ActionCreate
extends
BaseAction
{
...
...
@@ -30,71 +32,73 @@ class ActionCreate extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
List
<
String
>
consumers
=
Config
.
messages
().
getConsumers
(
wi
.
getType
());
Instant
instant
=
this
.
instant
(
effectivePerson
,
business
,
wi
,
consumers
);
List
<
Message
>
messages
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
consumers
))
{
List
<
Message
>
messages
=
new
ArrayList
<>();
emc
.
beginTransaction
(
Message
.
class
);
for
(
String
consumer
:
consumers
)
{
Message
message
=
null
;
switch
(
Objects
.
toString
(
consumer
,
""
))
{
case
MessageConnector
.
CONSUME_
IM
:
message
=
this
.
imMessage
(
effectivePerson
,
business
,
wi
);
case
MessageConnector
.
CONSUME_
WS
:
message
=
this
.
wsMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
case
MessageConnector
.
CONSUME_PMS
:
message
=
this
.
pmsMessage
(
effectivePerson
,
business
,
wi
);
message
=
this
.
pmsMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
case
MessageConnector
.
CONSUME_DINGDING
:
message
=
this
.
dingdingMessage
(
effectivePerson
,
business
,
wi
);
message
=
this
.
dingdingMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
case
MessageConnector
.
CONSUME_ZHENGWUDINGDING
:
message
=
this
.
zhegnwudingdingMessage
(
effectivePerson
,
business
,
wi
);
message
=
this
.
zhegnwudingdingMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
case
MessageConnector
.
CONSUME_QIYEWEIXIN
:
message
=
this
.
qiyeweixinMessage
(
effectivePerson
,
business
,
wi
);
message
=
this
.
qiyeweixinMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
case
MessageConnector
.
CONSUME_CALENDAR
:
message
=
this
.
calendarMessage
(
effectivePerson
,
business
,
wi
);
message
=
this
.
calendarMessage
(
effectivePerson
,
business
,
wi
,
instant
);
break
;
default
:
message
=
this
.
defaultMessage
(
effectivePerson
,
business
,
wi
,
consumer
);
message
=
this
.
defaultMessage
(
effectivePerson
,
business
,
wi
,
consumer
,
instant
);
break
;
}
emc
.
persist
(
message
,
CheckPersistType
.
all
);
messages
.
add
(
message
);
}
emc
.
commit
();
}
emc
.
beginTransaction
(
Instant
.
class
);
emc
.
persist
(
instant
,
CheckPersistType
.
all
);
if
(
ListTools
.
isNotEmpty
(
messages
))
{
emc
.
beginTransaction
(
Message
.
class
);
for
(
Message
message
:
messages
)
{
switch
(
message
.
getConsumer
())
{
case
MessageConnector
.
CONSUME_IM
:
ThisApplication
.
imConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_PMS
:
ThisApplication
.
pmsConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_DINGDING
:
ThisApplication
.
dingdingConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_ZHENGWUDINGDING
:
ThisApplication
.
zhengwuDingdingConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_QIYEWEIXIN
:
ThisApplication
.
qiyeweixinConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_CALENDAR
:
ThisApplication
.
calendarConsumeQueue
.
send
(
message
);
break
;
default
:
break
;
}
emc
.
persist
(
message
,
CheckPersistType
.
all
);
}
}
emc
.
commit
();
/* 开始发送,由于要回写所以先要commit */
for
(
Message
message
:
messages
)
{
switch
(
message
.
getConsumer
())
{
case
MessageConnector
.
CONSUME_WS
:
ThisApplication
.
wsConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_PMS
:
ThisApplication
.
pmsConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_DINGDING
:
ThisApplication
.
dingdingConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_ZHENGWUDINGDING
:
ThisApplication
.
zhengwuDingdingConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_QIYEWEIXIN
:
ThisApplication
.
qiyeweixinConsumeQueue
.
send
(
message
);
break
;
case
MessageConnector
.
CONSUME_CALENDAR
:
ThisApplication
.
calendarConsumeQueue
.
send
(
message
);
break
;
default
:
break
;
}
}
// this.im_consume(effectivePerson, business, message);
// this.pms_consume(effectivePerson, business, message);
// this.calendar_consume(effectivePerson, business, message);
// this.dingding_consume(effectivePerson, business, message);
// this.qiyeweixin_consume(effectivePerson, business, message);
// this.zhengwudingding_consume(effectivePerson, business, message);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
...
...
@@ -103,210 +107,102 @@ class ActionCreate extends BaseAction {
}
}
private
Message
imMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Instant
instant
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
List
<
String
>
consumers
)
{
Instant
instant
=
new
Instant
();
instant
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
instant
.
setType
(
wi
.
getType
());
instant
.
setPerson
(
wi
.
getPerson
());
instant
.
setTitle
(
wi
.
getTitle
());
instant
.
setConsumerList
(
consumers
);
instant
.
setConsumed
(
false
);
return
instant
;
}
private
Message
wsMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_IM
);
message
.
setConsumer
(
MessageConnector
.
CONSUME_WS
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
pmsMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Message
pmsMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_PMS
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
dingdingMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Message
dingdingMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_DINGDING
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
zhegnwudingdingMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Message
zhegnwudingdingMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_ZHENGWUDINGDING
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
qiyeweixinMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Message
qiyeweixinMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_QIYEWEIXIN
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
calendarMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
)
{
private
Message
calendarMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
MessageConnector
.
CONSUME_CALENDAR
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
private
Message
defaultMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
String
consumer
)
{
private
Message
defaultMessage
(
EffectivePerson
effectivePerson
,
Business
business
,
Wi
wi
,
String
consumer
,
Instant
instant
)
{
Message
message
=
new
Message
();
message
.
setBody
(
Objects
.
toString
(
wi
.
getBody
()));
message
.
setType
(
wi
.
getType
());
message
.
setPerson
(
wi
.
getPerson
());
message
.
setTitle
(
wi
.
getTitle
());
message
.
setConsumer
(
consumer
);
message
.
setConsumed
(
false
);
message
.
setInstant
(
instant
.
getId
());
return
message
;
}
// private void dingding_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_DINGDING)) {
// message.getConsumerList().remove(MessageConnector.CONSUME_DINGDING);
// if (Config.dingding().getEnable() && Config.dingding().getMessageEnable()) {
// DingdingMessage m = new DingdingMessage();
// m.setAgent_id(Long.parseLong(Config.dingding().getAgentId(), 10));
// m.setUserid_list(business.organization().person().getObject(message.getPerson()).getDingdingId());
// m.getMsg().getText().setContent(message.getTitle());
// // https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2?access_token=ACCESS_TOKEN
// String address = Config.dingding().getOapiAddress()
// + "/topapi/message/corpconversation/asyncsend_v2?access_token="
// + Config.dingding().corpAccessToken();
// DingdingMessageResp resp = HttpConnection.postAsObject(address, null, m.toString(),
// DingdingMessageResp.class);
// if (resp.getErrcode() != 0) {
// throw new ExceptionDingdingMessage(resp.getErrcode(), resp.getErrmsg());
// }
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
//
// private void zhengwudingding_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_ZHENGWUDINGDING)) {
// message.getConsumerList().remove(MessageConnector.CONSUME_ZHENGWUDINGDING);
// if (Config.zhengwuDingding().getEnable() && Config.zhengwuDingding().getMessageEnable()) {
// ZhengwuDingdingMessage m = new ZhengwuDingdingMessage();
// m.setAgentId(Long.parseLong(Config.zhengwuDingding().getAgentId(), 10));
// m.setTouser(business.organization().person().getObject(message.getPerson()).getZhengwuDingdingId());
// m.getMsg().getText().setContent(message.getTitle());
// String address = Config.zhengwuDingding().getOapiAddress() + "/ent_message/send?access_token="
// + Config.zhengwuDingding().appAccessToken();
// ZhengwuDingdingMessageResp resp = HttpConnection.postAsObject(address, null, m.toString(),
// ZhengwuDingdingMessageResp.class);
// if (resp.getRetCode() != 0) {
// throw new ExceptionZhengwuDingdingMessage(resp.getRetCode(), resp.getRetMessage());
// }
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
//
// private void qiyeweixin_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_QIYEWEIXIN)) {
// message.getConsumerList().remove(MessageConnector.CONSUME_QIYEWEIXIN);
// if (Config.qiyeweixin().getEnable() && Config.qiyeweixin().getMessageEnable()) {
// QiyeweixinMessage m = new QiyeweixinMessage();
// m.setAgentid(Long.parseLong(Config.qiyeweixin().getAgentId(), 10));
// m.setTouser(business.organization().person().getObject(message.getPerson()).getQiyeweixinId());
// m.getText().setContent(message.getTitle());
// String address = Config.qiyeweixin().getApiAddress() + "/cgi-bin/message/send?access_token="
// + Config.qiyeweixin().corpAccessToken();
// QiyeweixinMessageResp resp = HttpConnection.postAsObject(address, null, m.toString(),
// QiyeweixinMessageResp.class);
// if (resp.getErrcode() != 0) {
// throw new ExceptionQiyeweixinMessage(resp.getErrcode(), resp.getErrmsg());
// }
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
//
// private void im_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_IM)) {
// ImMessage im = new ImMessage();
// im.setType(message.getType());
// im.setPerson(message.getPerson());
// im.setTitle(message.getTitle());
// im.setBody(gson.fromJson(message.getBody(), JsonElement.class));
// for (Application app : ThisApplication.context().applications()
// .get(x_message_assemble_communicate.class)) {
// WrapBoolean wrapBoolean = ThisApplication.context().applications()
// .postQuery(effectivePerson.getDebugger(), app, MessageConnector.CONSUME_IM, im)
// .getData(WrapBoolean.class);
// if (BooleanUtils.isTrue(wrapBoolean.getValue())) {
// message.getConsumerList().remove(MessageConnector.CONSUME_IM);
// }
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
//
// private void pms_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_PMS)) {
// message.getConsumerList().remove(MessageConnector.CONSUME_PMS);
// Person person = business.organization().person().getObject(message.getPerson());
// if ((null != person) && StringUtils.isNotEmpty(person.getMobile())) {
// PmsMessage pms = new PmsMessage();
// pms.setAccount(person.getMobile());
// pms.setTitle(message.getTitle());
// pms.setText(message.getTitle());
// String url = Config.x_program_centerUrlRoot() + MessageConnector.CONSUME_PMS;
// CipherConnectionAction.post(effectivePerson.getDebugger(), url, pms);
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
//
// private void calendar_consume(EffectivePerson effectivePerson, Business business, Message message) {
// try {
// if (ListTools.contains(message.getConsumerList(), MessageConnector.CONSUME_CALENDAR)) {
// Application app = ThisApplication.context().applications()
// .randomWithWeight(x_calendar_assemble_control.class.getName());
// if (null != app) {
// WrapBoolean wrapBoolean = ThisApplication.context().applications()
// .postQuery(effectivePerson.getDebugger(), app, "message", message)
// .getData(WrapBoolean.class);
// if (BooleanUtils.isTrue(wrapBoolean.getValue())) {
// message.getConsumerList().remove(MessageConnector.CONSUME_CALENDAR);
// }
// } else {
// throw new ExceptionCalendarApplicationNotFound();
// }
// }
// } catch (Exception e) {
// logger.error(e);
// }
// }
public
static
class
Wi
extends
MessageConnector
.
Wrap
{
}
...
...
@@ -314,166 +210,4 @@ class ActionCreate extends BaseAction {
}
// public static class ZhengwuDingdingMessageResp {
//
// private Integer retCode;
// private String retMessage;
// private RetData retData;
//
// public static class RetData {
// private String invaliduser;
// private String invalidparty;
// private String errorparty;
// private String erroruser;
//
// public String getInvaliduser() {
// return invaliduser;
// }
//
// public void setInvaliduser(String invaliduser) {
// this.invaliduser = invaliduser;
// }
//
// public String getInvalidparty() {
// return invalidparty;
// }
//
// public void setInvalidparty(String invalidparty) {
// this.invalidparty = invalidparty;
// }
//
// public String getErrorparty() {
// return errorparty;
// }
//
// public void setErrorparty(String errorparty) {
// this.errorparty = errorparty;
// }
//
// public String getErroruser() {
// return erroruser;
// }
//
// public void setErroruser(String erroruser) {
// this.erroruser = erroruser;
// }
//
// }
//
// public Integer getRetCode() {
// return retCode;
// }
//
// public void setRetCode(Integer retCode) {
// this.retCode = retCode;
// }
//
// public String getRetMessage() {
// return retMessage;
// }
//
// public void setRetMessage(String retMessage) {
// this.retMessage = retMessage;
// }
//
// public RetData getRetData() {
// return retData;
// }
//
// public void setRetData(RetData retData) {
// this.retData = retData;
// }
//
// }
// public static class DingdingMessageResp {
//
// private Integer errcode;
// private String errmsg;
// private Long task_id;
//
// public String getErrmsg() {
// return errmsg;
// }
//
// public void setErrmsg(String errmsg) {
// this.errmsg = errmsg;
// }
//
// public Long getTask_id() {
// return task_id;
// }
//
// public void setTask_id(Long task_id) {
// this.task_id = task_id;
// }
//
// public Integer getErrcode() {
// return errcode;
// }
//
// public void setErrcode(Integer errcode) {
// this.errcode = errcode;
// }
//
// }
// public static class QiyeweixinMessageResp {
//
// // {
// // "errcode" : 0,
// // "errmsg" : "ok",
// // "invaliduser" : "userid1|userid2", // 不区分大小写,返回的列表都统一转为小写
// // "invalidparty" : "partyid1|partyid2",
// // "invalidtag":"tagid1|tagid2"
// // }
//
// private Integer errcode;
// private String errmsg;
// private String invaliduser;
// private String invalidparty;
// private String invalidtag;
//
// public String getErrmsg() {
// return errmsg;
// }
//
// public void setErrmsg(String errmsg) {
// this.errmsg = errmsg;
// }
//
// public String getInvaliduser() {
// return invaliduser;
// }
//
// public void setInvaliduser(String invaliduser) {
// this.invaliduser = invaliduser;
// }
//
// public String getInvalidparty() {
// return invalidparty;
// }
//
// public void setInvalidparty(String invalidparty) {
// this.invalidparty = invalidparty;
// }
//
// public String getInvalidtag() {
// return invalidtag;
// }
//
// public void setInvalidtag(String invalidtag) {
// this.invalidtag = invalidtag;
// }
//
// public Integer getErrcode() {
// return errcode;
// }
//
// public void setErrcode(Integer errcode) {
// this.errcode = errcode;
// }
//
// }
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionList.java
浏览文件 @
b9643db1
...
...
@@ -19,7 +19,7 @@ import com.x.base.core.project.http.ActionResult;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.
Im
Message
;
import
com.x.base.core.project.message.
Ws
Message
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
...
...
@@ -49,7 +49,7 @@ class ActionList extends BaseAction {
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wi
extends
Im
Message
{
public
static
class
Wi
extends
Ws
Message
{
}
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithCurrentPerson.java
浏览文件 @
b9643db1
...
...
@@ -8,7 +8,6 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
...
...
@@ -16,12 +15,11 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
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.ExceptionPersonNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.
Im
Message
;
import
com.x.base.core.project.message.
Ws
Message
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
...
...
@@ -53,7 +51,7 @@ class ActionListWithCurrentPerson extends BaseAction {
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wi
extends
Im
Message
{
public
static
class
Wi
extends
Ws
Message
{
}
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithPerson.java
浏览文件 @
b9643db1
...
...
@@ -21,7 +21,7 @@ import com.x.base.core.project.http.ActionResult;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.
Im
Message
;
import
com.x.base.core.project.message.
Ws
Message
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
...
...
@@ -57,7 +57,7 @@ class ActionListWithPerson extends BaseAction {
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wi
extends
Im
Message
{
public
static
class
Wi
extends
Ws
Message
{
}
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumed.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
java.util.ArrayList
;
import
java.util.List
;
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.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.message.core.entity.Instant
;
class
ActionCurrentPersonConsumed
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumed
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
ListTools
.
isNotEmpty
(
wi
.
getIdList
()))
{
List
<
Instant
>
os
=
emc
.
listEqualAndIn
(
Instant
.
class
,
Instant
.
person_FIELDNAME
,
effectivePerson
.
getDistinguishedName
(),
Instant
.
id_FIELDNAME
,
wi
.
getIdList
());
if
(!
os
.
isEmpty
())
{
emc
.
beginTransaction
(
Instant
.
class
);
for
(
Instant
o
:
os
)
{
o
.
setConsumed
(
true
);
}
emc
.
commit
();
}
}
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"标识"
)
List
<
String
>
idList
=
new
ArrayList
<>();
public
List
<
String
>
getIdList
()
{
return
idList
;
}
public
void
setIdList
(
List
<
String
>
idList
)
{
this
.
idList
=
idList
;
}
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
java.util.List
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.core.entity.Instant
;
class
ActionCurrentPersonConsumedAll
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumedAll
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
List
<
Instant
>
os
=
emc
.
listEqual
(
Instant
.
class
,
Instant
.
person_FIELDNAME
,
effectivePerson
.
getDistinguishedName
());
if
(!
os
.
isEmpty
())
{
emc
.
beginTransaction
(
Instant
.
class
);
for
(
Instant
o
:
os
)
{
o
.
setConsumed
(
true
);
}
emc
.
commit
();
}
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListNext.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
java.util.List
;
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.project.annotation.FieldDescribe
;
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.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
class
ActionListNext
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
OrganizationDefinition
.
Manager
,
OrganizationDefinition
.
MessageManager
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
result
=
this
.
standardListNext
(
Wo
.
copier
,
id
,
count
,
JpaObject
.
sequence_FIELDNAME
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
true
,
DESC
);
return
result
;
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
-
125007357898871894L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Instant
.
class
,
true
,
true
),
null
);
@FieldDescribe
(
"排序号"
)
private
Long
rank
;
public
Long
getRank
()
{
return
rank
;
}
public
void
setRank
(
Long
rank
)
{
this
.
rank
=
rank
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListPrev.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
java.util.List
;
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.project.annotation.FieldDescribe
;
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.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
class
ActionListPrev
extends
BaseAction
{
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
OrganizationDefinition
.
Manager
,
OrganizationDefinition
.
MessageManager
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
result
=
this
.
standardListPrev
(
Wo
.
copier
,
id
,
count
,
JpaObject
.
sequence_FIELDNAME
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
true
,
DESC
);
return
result
;
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
-
125007357898871894L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
JpaObject
.
singularAttributeField
(
Instant
.
class
,
true
,
true
),
null
);
@FieldDescribe
(
"排序号"
)
private
Long
rank
;
public
Long
getRank
()
{
return
rank
;
}
public
void
setRank
(
Long
rank
)
{
this
.
rank
=
rank
;
}
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonConsumedAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Instant_
.
consumed
),
true
));
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedDesc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonConsumedDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Instant_
.
consumed
),
true
));
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
desc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
desc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonNotConsumedAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Instant_
.
consumed
),
false
));
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedDesc.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
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.apache.commons.lang3.math.NumberUtils
;
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.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
class
ActionListWithCurrentPersonNotConsumedDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
this
.
list
(
business
,
NumberUtils
.
min
(
200
,
NumberUtils
.
max
(
1
,
count
)),
effectivePerson
);
result
.
setData
(
wos
);
return
result
;
}
}
private
List
<
Wo
>
list
(
Business
business
,
Integer
count
,
EffectivePerson
effectivePerson
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Instant_
.
person
),
effectivePerson
.
getDistinguishedName
());
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Instant_
.
consumed
),
false
));
List
<
Instant
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
desc
(
root
.
get
(
Instant_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
public
static
class
Wo
extends
Instant
{
private
static
final
long
serialVersionUID
=
681982898431236763L
;
static
WrapCopier
<
Instant
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Instant
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/BaseAction.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/InstantAction.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.instant
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.PUT
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.container.AsyncResponse
;
import
javax.ws.rs.container.Suspended
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
import
com.x.base.core.project.annotation.JaxrsParameterDescribe
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpMediaType
;
import
com.x.base.core.project.jaxrs.ResponseFactory
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
@Path
(
"instant"
)
@JaxrsDescribe
(
"主体消息"
)
public
class
InstantAction
extends
StandardJaxrsAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
InstantAction
.
class
);
@JaxrsMethodDescribe
(
value
=
"列示所有的主体消息,需要管理员权限或者MessageManager,下一页."
,
action
=
ActionListNext
.
class
)
@GET
@Path
(
"list/{id}/next/{count}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listNext
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListNext
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListNext
().
execute
(
effectivePerson
,
id
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示所有的主体消息,需要管理员权限或者MessageManager,上一页."
,
action
=
ActionListPrev
.
class
)
@GET
@Path
(
"list/{id}/prev/{count}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listPrev
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"标识"
)
@PathParam
(
"id"
)
String
id
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListPrev
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListPrev
().
execute
(
effectivePerson
,
id
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员的主体消息,倒序."
,
action
=
ActionListWithCurrentPersonDesc
.
class
)
@GET
@Path
(
"list/currentperson/count/{count}/desc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentPersonDesc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonDesc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonDesc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员的主体消息,顺序."
,
action
=
ActionListWithCurrentPersonAsc
.
class
)
@GET
@Path
(
"list/currentperson/count/{count}/asc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentPersonAsc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonAsc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonAsc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员已经消费的主体消息,倒序."
,
action
=
ActionListWithCurrentPersonConsumedDesc
.
class
)
@GET
@Path
(
"list/currentperson/consumed/count/{count}/desc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentConsumedPersonDesc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonConsumedDesc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonConsumedDesc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员已经消费的主体消息,顺序."
,
action
=
ActionListWithCurrentPersonConsumedAsc
.
class
)
@GET
@Path
(
"list/currentperson/consumed/count/{count}/asc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentPersonConsumedAsc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonConsumedAsc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonConsumedAsc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员还未消费的主体消息,倒序."
,
action
=
ActionListWithCurrentPersonNotConsumedDesc
.
class
)
@GET
@Path
(
"list/currentperson/not/consumed/count/{count}/desc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentNotConsumedPersonDesc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonNotConsumedDesc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonNotConsumedDesc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取当前人员还未消费的主体消息,顺序."
,
action
=
ActionListWithCurrentPersonNotConsumedAsc
.
class
)
@GET
@Path
(
"list/currentperson/not/consumed/count/{count}/asc"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listWithCurrentPersonNotConsumedAsc
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"数量"
)
@PathParam
(
"count"
)
Integer
count
)
{
ActionResult
<
List
<
ActionListWithCurrentPersonNotConsumedAsc
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListWithCurrentPersonNotConsumedAsc
().
execute
(
effectivePerson
,
count
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"将当前用户指定的主体消息标识为已消费."
,
action
=
ActionCurrentPersonConsumed
.
class
)
@PUT
@Path
(
"currentperson/consumed"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
currentPersonConsumed
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
JsonElement
jsonElement
)
{
ActionResult
<
ActionCurrentPersonConsumed
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionCurrentPersonConsumed
().
execute
(
effectivePerson
,
jsonElement
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
jsonElement
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
@JaxrsMethodDescribe
(
value
=
"将当前用户所有主体消息全部标识为已消费."
,
action
=
ActionCurrentPersonConsumedAll
.
class
)
@GET
@Path
(
"currentperson/consumed/all"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
currentPersonConsumedAll
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
ActionCurrentPersonConsumedAll
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionCurrentPersonConsumedAll
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getDefaultActionResultResponse
(
result
));
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
im
/ActionCreate.java
→
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
ws
/ActionCreate.java
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.
im
;
package
com.x.message.assemble.communicate.jaxrs.
ws
;
import
javax.websocket.Session
;
...
...
@@ -8,7 +8,7 @@ import com.x.base.core.project.http.EffectivePerson;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.message.
Im
Message
;
import
com.x.base.core.project.message.
Ws
Message
;
import
com.x.message.assemble.communicate.ThisApplication
;
class
ActionCreate
extends
BaseAction
{
...
...
@@ -22,7 +22,7 @@ class ActionCreate extends BaseAction {
wo
.
setValue
(
false
);
Session
session
=
ThisApplication
.
connections
.
get
(
wi
.
getPerson
());
if
(
session
!=
null
&&
session
.
isOpen
())
{
logger
.
debug
(
effectivePerson
,
"send
pm
s, message: {}."
,
wi
);
logger
.
debug
(
effectivePerson
,
"send
w
s, message: {}."
,
wi
);
session
.
getBasicRemote
().
sendText
(
jsonElement
.
toString
());
wo
.
setValue
(
true
);
}
...
...
@@ -30,7 +30,7 @@ class ActionCreate extends BaseAction {
return
result
;
}
public
static
class
Wi
extends
Im
Message
{
public
static
class
Wi
extends
Ws
Message
{
}
public
static
class
Wo
extends
WrapBoolean
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
im
/BaseAction.java
→
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
ws
/BaseAction.java
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.
im
;
package
com.x.message.assemble.communicate.jaxrs.
ws
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
im/Im
Action.java
→
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/
ws/Ws
Action.java
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.jaxrs.
im
;
package
com.x.message.assemble.communicate.jaxrs.
ws
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
...
...
@@ -22,13 +22,13 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
@Path
(
"
im
"
)
@JaxrsDescribe
(
"
即时
消息"
)
public
class
Im
Action
extends
StandardJaxrsAction
{
@Path
(
"
ws
"
)
@JaxrsDescribe
(
"
webSocket
消息"
)
public
class
Ws
Action
extends
StandardJaxrsAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
Im
Action
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
Ws
Action
.
class
);
@JaxrsMethodDescribe
(
value
=
"发送
推送
消息."
,
action
=
ActionCreate
.
class
)
@JaxrsMethodDescribe
(
value
=
"发送
webSocket
消息."
,
action
=
ActionCreate
.
class
)
@POST
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/Clean.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.schedule
;
import
java.util.Date
;
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.apache.commons.lang3.time.DateUtils
;
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.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.utils.time.TimeStamp
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Instant
;
import
com.x.message.core.entity.Instant_
;
import
com.x.message.core.entity.Message
;
import
com.x.message.core.entity.Message_
;
public
class
Clean
implements
Job
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
Clean
.
class
);
@Override
public
void
execute
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
TimeStamp
stamp
=
new
TimeStamp
();
Business
business
=
new
Business
(
emc
);
Long
instantCount
=
this
.
clearInstant
(
business
);
Long
messageCount
=
this
.
clearMessage
(
business
);
logger
.
print
(
"清理过期的消息内容,其中主体消息: {} 条, 消息: {} 条, 耗时: {}."
,
instantCount
,
messageCount
,
stamp
.
consumingMilliseconds
());
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
new
JobExecutionException
(
e
);
}
}
private
Long
clearInstant
(
Business
business
)
throws
Exception
{
List
<
Instant
>
os
=
null
;
Long
count
=
0L
;
do
{
os
=
this
.
listInstant
(
business
);
if
(!
os
.
isEmpty
())
{
business
.
entityManagerContainer
().
beginTransaction
(
Instant
.
class
);
for
(
Instant
o
:
os
)
{
business
.
entityManagerContainer
().
remove
(
o
);
}
business
.
entityManagerContainer
().
commit
();
count
+=
os
.
size
();
}
}
while
(
ListTools
.
isNotEmpty
(
os
));
return
count
;
}
private
List
<
Instant
>
listInstant
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Instant
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Instant
>
cq
=
cb
.
createQuery
(
Instant
.
class
);
Root
<
Instant
>
root
=
cq
.
from
(
Instant
.
class
);
Date
limit
=
DateUtils
.
addDays
(
new
Date
(),
-
7
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
Instant_
.
createTime
),
limit
);
return
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
)).
setMaxResults
(
2000
).
getResultList
();
}
private
Long
clearMessage
(
Business
business
)
throws
Exception
{
List
<
Message
>
os
=
null
;
Long
count
=
0L
;
do
{
os
=
this
.
listMessage
(
business
);
if
(!
os
.
isEmpty
())
{
business
.
entityManagerContainer
().
beginTransaction
(
Message
.
class
);
for
(
Message
o
:
os
)
{
business
.
entityManagerContainer
().
remove
(
o
);
}
business
.
entityManagerContainer
().
commit
();
count
+=
os
.
size
();
}
}
while
(
ListTools
.
isNotEmpty
(
os
));
return
count
;
}
private
List
<
Message
>
listMessage
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Message
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
Message
>
cq
=
cb
.
createQuery
(
Message
.
class
);
Root
<
Message
>
root
=
cq
.
from
(
Message
.
class
);
Date
limit
=
DateUtils
.
addDays
(
new
Date
(),
-
7
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
Message_
.
createTime
),
limit
);
return
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
)).
setMaxResults
(
2000
).
getResultList
();
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/schedule/CleanConnections.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.schedule
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
javax.websocket.Session
;
import
org.quartz.Job
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.ThisApplication
;
public
class
CleanConnections
implements
Job
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CleanConnections
.
class
);
@Override
/* 定时清理session已经关闭的用户 */
public
void
execute
(
JobExecutionContext
arg0
)
throws
JobExecutionException
{
try
{
List
<
String
>
removes
=
new
ArrayList
<>();
for
(
Entry
<
String
,
Session
>
entry
:
ThisApplication
.
connections
.
entrySet
())
{
if
((
null
==
entry
.
getValue
())
||
(!
entry
.
getValue
().
isOpen
()))
{
removes
.
add
(
entry
.
getKey
());
}
}
for
(
String
str
:
removes
)
{
ThisApplication
.
connections
.
remove
(
str
);
}
logger
.
debug
(
"clean {} websocket session, {} online."
,
removes
.
size
(),
ThisApplication
.
connections
.
size
());
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
new
JobExecutionException
(
e
);
}
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/ActionCollaboration.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.assemble.communicate.ws.collaboration
;
import
java.io.IOException
;
import
javax.websocket.CloseReason
;
import
javax.websocket.OnClose
;
import
javax.websocket.OnError
;
import
javax.websocket.OnOpen
;
import
javax.websocket.Session
;
import
javax.websocket.server.ServerEndpoint
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpToken
;
import
com.x.base.core.project.http.TokenType
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.assemble.communicate.ThisApplication
;
@ServerEndpoint
(
value
=
"/ws/collaboration"
,
configurator
=
WsConfigurator
.
class
)
public
class
ActionCollaboration
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCollaboration
.
class
);
@OnOpen
public
void
open
(
Session
session
)
{
EffectivePerson
effectivePerson
=
(
EffectivePerson
)
session
.
getUserProperties
().
get
(
HttpToken
.
X_Person
);
logger
.
debug
(
"@OnOpen: tokenType:{}, distinguishedName:{}."
,
effectivePerson
.
getTokenType
(),
effectivePerson
.
getDistinguishedName
());
if
(
TokenType
.
anonymous
.
equals
(
effectivePerson
.
getTokenType
()))
{
return
;
}
ThisApplication
.
connections
.
put
(
effectivePerson
.
getDistinguishedName
(),
session
);
}
@OnClose
public
void
close
(
Session
session
,
CloseReason
reason
)
throws
IOException
{
EffectivePerson
effectivePerson
=
(
EffectivePerson
)
session
.
getUserProperties
().
get
(
HttpToken
.
X_Person
);
logger
.
debug
(
"@OnOpen: tokenType:{}, distinguishedName:{}."
,
effectivePerson
.
getTokenType
(),
effectivePerson
.
getDistinguishedName
());
if
(
TokenType
.
anonymous
.
equals
(
effectivePerson
.
getTokenType
()))
{
return
;
}
ThisApplication
.
connections
.
remove
(
effectivePerson
.
getDistinguishedName
());
}
@OnError
public
void
error
(
Throwable
t
)
throws
Throwable
{
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/CollaborationAction.java
已删除
100644 → 0
浏览文件 @
72ca7eac
//package com.x.message.assemble.communicate.ws.collaboration;
//
//import java.awt.Dialog;
//import java.awt.JobAttributes.DialogType;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//import javax.jms.TextMessage;
//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 javax.websocket.CloseReason;
//import javax.websocket.OnClose;
//import javax.websocket.OnError;
//import javax.websocket.OnMessage;
//import javax.websocket.OnOpen;
//import javax.websocket.Session;
//import javax.websocket.server.ServerEndpoint;
//
//import org.apache.commons.lang3.StringUtils;
//
//import com.google.gson.Gson;
//import com.google.gson.JsonElement;
//import com.sun.nio.sctp.Notification;
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.container.factory.EntityManagerContainerFactory;
//import com.x.base.core.project.x_collaboration_assemble_websocket;
//import com.x.base.core.project.gson.XGsonBuilder;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.http.HttpToken;
//import com.x.base.core.project.http.TokenType;
//import com.x.base.core.project.http.WrapOutBoolean;
//import com.x.base.core.project.tools.SortTools;
//import com.x.collaboration.core.entity.Dialog_;
//import com.x.collaboration.core.entity.Notification_;
//import com.x.collaboration.core.message.BaseMessage;
//import com.x.collaboration.core.message.MessageCategory;
//import com.x.collaboration.core.message.dialog.DialogMessage;
//import com.x.message.assemble.communicate.ThisApplication;
//
//@ServerEndpoint(value = "/ws/collaboration", configurator = WsConfigurator.class)
//public class CollaborationAction {
//
// private final static Gson gson = XGsonBuilder.instance();
//
// @OnOpen
// public void open(Session session) {
// EffectivePerson effectivePerson = (EffectivePerson) session.getUserProperties().get(HttpToken.X_Person);
// if (TokenType.anonymous.equals(effectivePerson.getTokenType())) {
// return;
// }
// ThisApplication.connections.put(effectivePerson.getDistinguishedName(), session);
// try {
// List<Notification> notifications = this.loadNotifications(effectivePerson.getDistinguishedName());
// for (Notification o : notifications) {
// session.getBasicRemote().sendText(o.getBody());
// }
// List<Dialog> dialogs = this.loadDialogs(effectivePerson.getDistinguishedName());
// for (Dialog o : dialogs) {
// session.getBasicRemote().sendText(o.getBody());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @OnClose
// public void close(Session session, CloseReason reason) throws IOException {
// EffectivePerson effectivePerson = (EffectivePerson) session.getUserProperties().get(HttpToken.X_Person);
// if (TokenType.anonymous.equals(effectivePerson.getTokenType())) {
// return;
// }
// ThisApplication.connections.remove(effectivePerson.getDistinguishedName());
// }
//
// @OnError
// public void error(Throwable t) throws Throwable {
//
// }
//
// @OnMessage
// public void handlingText(String text, Session session) {
// EffectivePerson effectivePerson = (EffectivePerson) session.getUserProperties().get(HttpToken.X_Person);
// if (TokenType.anonymous.equals(effectivePerson.getTokenType())) {
// return;
// }
// try {
// JsonElement jsonElement = gson.fromJson(text, JsonElement.class);
// MessageCategory category = BaseMessage.extractCategory(jsonElement);
// if (null != category) {
// switch (category) {
// case notification:
// break;
// case dialog:
// this.dialog(jsonElement, effectivePerson);
// break;
// case operation:
// break;
// default:
// break;
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @OnMessage
// public void handlingBinary(byte[] binary, boolean last, Session session) {
// System.out.println("received binary:" + binary.toString());
// }
//
// private List<Notification> loadNotifications(String person) throws Exception {
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// EntityManager em = emc.get(Notification.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Notification> cq = cb.createQuery(Notification.class);
// Root<Notification> root = cq.from(Notification.class);
// Predicate p = cb.equal(root.get(Notification_.person), person);
// cq.select(root).where(p);
// List<Notification> list = em.createQuery(cq).getResultList();
// emc.beginTransaction(Notification.class);
// for (Notification o : list) {
// emc.remove(o);
// }
// emc.commit();
// List<Notification> messages = new ArrayList<>(list);
// SortTools.asc(messages, false, "createTime");
// return messages;
// }
// }
//
// private List<Dialog> loadDialogs(String person) throws Exception {
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// EntityManager em = emc.get(Dialog.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Dialog> cq = cb.createQuery(Dialog.class);
// Root<Dialog> root = cq.from(Dialog.class);
// Predicate p = cb.equal(root.get(Dialog_.person), person);
// p = cb.and(p, cb.notEqual(root.get(Dialog_.arrived), true));
// cq.select(root).where(p);
// List<Dialog> list = em.createQuery(cq).getResultList();
// emc.beginTransaction(Dialog.class);
// for (Dialog o : list) {
// o.setArrived(true);
// }
// emc.commit();
// List<Dialog> messages = new ArrayList<>(list);
// SortTools.asc(messages, false, "createTime");
// return messages;
// }
// }
//
// private void dialog(JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception {
// DialogType type = DialogMessage.extractType(jsonElement);
// if (null != type) {
// switch (type) {
// case text:
// dialogText(jsonElement, effectivePerson);
// break;
// default:
// break;
// }
// }
// }
//
// private WrapOutBoolean dialogText(JsonElement jsonElement, EffectivePerson effectivePerson) throws Exception {
// TextMessage message = gson.fromJson(jsonElement, TextMessage.class);
// if (StringUtils.isEmpty(message.getPerson())) {
// throw new Exception("invaild message:" + message);
// }
// message.setFrom(effectivePerson.getDistinguishedName());
// message.setTime(new Date());
// WrapOutBoolean wrap = ThisApplication.context().applications()
// .postQuery(x_collaboration_assemble_websocket.class, "message", message).getData(WrapOutBoolean.class);
// return wrap;
//
// }
//}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/ws/collaboration/WsConfigurator.java
浏览文件 @
b9643db1
...
...
@@ -14,6 +14,7 @@ import com.x.base.core.project.http.HttpToken;
import
com.x.base.core.project.tools.ListTools
;
public
class
WsConfigurator
extends
ServerEndpointConfig
.
Configurator
{
@Override
public
void
modifyHandshake
(
ServerEndpointConfig
config
,
HandshakeRequest
request
,
HandshakeResponse
response
)
{
try
{
...
...
@@ -33,7 +34,7 @@ public class WsConfigurator extends ServerEndpointConfig.Configurator {
}
if
(
StringUtils
.
isNotEmpty
(
token
))
{
HttpToken
httpToken
=
new
HttpToken
();
return
httpToken
.
who
(
token
,
Config
.
token
().
getCipher
());
return
httpToken
.
who
(
token
,
Config
.
token
().
getCipher
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
o2server/x_message_assemble_communicate/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Instant.java
0 → 100644
浏览文件 @
b9643db1
package
com.x.message.core.entity
;
import
java.util.List
;
import
javax.persistence.Basic
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.Id
;
import
javax.persistence.Inheritance
;
import
javax.persistence.InheritanceType
;
import
javax.persistence.Lob
;
import
javax.persistence.OrderColumn
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
org.apache.openjpa.persistence.PersistentCollection
;
import
org.apache.openjpa.persistence.jdbc.ContainerTable
;
import
org.apache.openjpa.persistence.jdbc.ElementColumn
;
import
org.apache.openjpa.persistence.jdbc.ElementIndex
;
import
org.apache.openjpa.persistence.jdbc.Index
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.entity.SliceJpaObject
;
import
com.x.base.core.entity.annotation.CheckPersist
;
import
com.x.base.core.entity.annotation.ContainerEntity
;
import
com.x.base.core.project.annotation.FieldDescribe
;
@Entity
@ContainerEntity
@Table
(
name
=
PersistenceProperties
.
Instant
.
table
,
uniqueConstraints
=
{
@UniqueConstraint
(
name
=
PersistenceProperties
.
Instant
.
table
+
JpaObject
.
IndexNameMiddle
+
JpaObject
.
DefaultUniqueConstraintSuffix
,
columnNames
=
{
JpaObject
.
IDCOLUMN
,
JpaObject
.
CREATETIMECOLUMN
,
JpaObject
.
UPDATETIMECOLUMN
,
JpaObject
.
SEQUENCECOLUMN
})
})
@Inheritance
(
strategy
=
InheritanceType
.
TABLE_PER_CLASS
)
public
class
Instant
extends
SliceJpaObject
{
private
static
final
long
serialVersionUID
=
5733185578089403629L
;
private
static
final
String
TABLE
=
PersistenceProperties
.
Instant
.
table
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
@FieldDescribe
(
"ID,数据库主键."
)
@Id
@Column
(
length
=
length_id
,
name
=
IDCOLUMN
)
private
String
id
=
createId
();
/* 以上为 JpaObject 默认字段 */
public
void
onPersist
()
throws
Exception
{
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
public
static
final
String
title_FIELDNAME
=
"title"
;
@FieldDescribe
(
"通知标题."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
title_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
title_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
)
private
String
title
;
public
static
final
String
body_FIELDNAME
=
"body"
;
@FieldDescribe
(
"内容."
)
@Lob
@Basic
(
fetch
=
FetchType
.
EAGER
)
@Column
(
length
=
length_10M
,
name
=
ColumnNamePrefix
+
body_FIELDNAME
)
private
String
body
;
public
static
final
String
type_FIELDNAME
=
"type"
;
@FieldDescribe
(
"消息类型."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
type_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
type_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
private
String
type
;
public
static
final
String
person_FIELDNAME
=
"person"
;
@FieldDescribe
(
"通知对象."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
person_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
person_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
private
String
person
;
public
static
final
String
consumed_FIELDNAME
=
"consumed"
;
@FieldDescribe
(
"是否已经消费掉."
)
@Column
(
name
=
ColumnNamePrefix
+
consumed_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
consumed_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
private
Boolean
consumed
;
public
static
final
String
consumerList_FIELDNAME
=
"consumerList"
;
@FieldDescribe
(
"消费对象."
)
@PersistentCollection
(
fetch
=
FetchType
.
EAGER
)
@OrderColumn
(
name
=
ORDERCOLUMNCOLUMN
)
@ContainerTable
(
name
=
TABLE
+
ContainerTableNameMiddle
+
consumerList_FIELDNAME
,
joinIndex
=
@Index
(
name
=
TABLE
+
consumerList_FIELDNAME
+
JoinIndexNameSuffix
))
@ElementColumn
(
length
=
JpaObject
.
length_64B
,
name
=
ColumnNamePrefix
+
consumerList_FIELDNAME
)
@ElementIndex
(
name
=
TABLE
+
consumerList_FIELDNAME
+
ElementIndexNameSuffix
)
private
List
<
String
>
consumerList
;
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
List
<
String
>
getConsumerList
()
{
return
consumerList
;
}
public
void
setConsumerList
(
List
<
String
>
consumerList
)
{
this
.
consumerList
=
consumerList
;
}
public
String
getPerson
()
{
return
person
;
}
public
void
setPerson
(
String
person
)
{
this
.
person
=
person
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Boolean
getConsumed
()
{
return
consumed
;
}
public
void
setConsumed
(
Boolean
consumed
)
{
this
.
consumed
=
consumed
;
}
}
\ No newline at end of file
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/Message.java
浏览文件 @
b9643db1
...
...
@@ -55,6 +55,13 @@ public class Message extends SliceJpaObject {
/* flag标志位 */
/* Entity 默认字段结束 */
public
static
final
String
title_FIELDNAME
=
"title"
;
@FieldDescribe
(
"通知标题."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
title_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
title_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
)
private
String
title
;
public
static
final
String
body_FIELDNAME
=
"body"
;
@FieldDescribe
(
"内容."
)
@Lob
...
...
@@ -66,39 +73,36 @@ public class Message extends SliceJpaObject {
@FieldDescribe
(
"消息类型."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
type_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
type_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
tru
e
)
@CheckPersist
(
allowEmpty
=
fals
e
)
private
String
type
;
// public static final String consumerList_FIELDNAME = "consumerList";
// @FieldDescribe("消费对象.")
// @PersistentCollection(fetch = FetchType.EAGER)
// @OrderColumn(name = ORDERCOLUMNCOLUMN)
// @ContainerTable(name = TABLE + ContainerTableNameMiddle
// + consumerList_FIELDNAME, joinIndex = @Index(name = TABLE + consumerList_FIELDNAME + JoinIndexNameSuffix))
// @ElementColumn(length = JpaObject.length_64B, name = ColumnNamePrefix + consumerList_FIELDNAME)
// @ElementIndex(name = TABLE + consumerList_FIELDNAME + ElementIndexNameSuffix)
// private List<String> consumerList;
public
static
final
String
consumer_FIELDNAME
=
"consumer"
;
@FieldDescribe
(
"消费者."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
consumer_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
consumer_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
tru
e
)
@CheckPersist
(
allowEmpty
=
fals
e
)
private
String
consumer
;
public
static
final
String
person_FIELDNAME
=
"person"
;
@FieldDescribe
(
"通知对象."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
person_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
person_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
tru
e
)
@CheckPersist
(
allowEmpty
=
fals
e
)
private
String
person
;
public
static
final
String
title_FIELDNAME
=
"title"
;
@FieldDescribe
(
"通知标题."
)
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
title_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
title_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
true
)
private
String
title
;
public
static
final
String
consumed_FIELDNAME
=
"consumed"
;
@FieldDescribe
(
"是否已经消费掉."
)
@Column
(
name
=
ColumnNamePrefix
+
consumed_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
consumed_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
private
Boolean
consumed
;
public
static
final
String
instant_FIELDNAME
=
"instant"
;
@FieldDescribe
(
"主体消息id."
)
@Column
(
length
=
JpaObject
.
length_id
,
name
=
ColumnNamePrefix
+
instant_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
instant_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
)
private
String
instant
;
public
String
getBody
()
{
return
body
;
...
...
@@ -116,14 +120,6 @@ public class Message extends SliceJpaObject {
this
.
type
=
type
;
}
// public List<String> getConsumerList() {
// return consumerList;
// }
//
// public void setConsumerList(List<String> consumerList) {
// this.consumerList = consumerList;
// }
public
String
getPerson
()
{
return
person
;
}
...
...
@@ -148,4 +144,20 @@ public class Message extends SliceJpaObject {
this
.
consumer
=
consumer
;
}
public
Boolean
getConsumed
()
{
return
consumed
;
}
public
void
setConsumed
(
Boolean
consumed
)
{
this
.
consumed
=
consumed
;
}
public
String
getInstant
()
{
return
instant
;
}
public
void
setInstant
(
String
instant
)
{
this
.
instant
=
instant
;
}
}
\ No newline at end of file
o2server/x_message_core_entity/src/main/java/com/x/message/core/entity/PersistenceProperties.java
浏览文件 @
b9643db1
...
...
@@ -4,6 +4,10 @@ import com.x.base.core.entity.AbstractPersistenceProperties;
public
final
class
PersistenceProperties
extends
AbstractPersistenceProperties
{
public
static
class
Instant
{
public
static
final
String
table
=
"MSG_INSTANT"
;
}
public
static
class
Message
{
public
static
final
String
table
=
"MSG_MESSAGE"
;
}
...
...
o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/ThisApplication.java
浏览文件 @
b9643db1
...
...
@@ -4,7 +4,6 @@ import java.util.HashMap;
import
java.util.Map
;
import
com.x.base.core.project.Context
;
import
com.x.collaboration.core.message.Collaboration
;
import
com.x.okr.assemble.control.jaxrs.queue.QueueWorkDynamicRecord
;
import
com.x.okr.assemble.control.jaxrs.workimport.CacheImportFileStatus
;
import
com.x.okr.assemble.control.schedule.ErrorIdentityCheckTask
;
...
...
@@ -19,11 +18,11 @@ import com.x.okr.assemble.control.service.OkrConfigSystemService;
public
class
ThisApplication
{
protected
static
Context
context
;
public
static
Map
<
String
,
CacheImportFileStatus
>
importFileStatusMap
=
new
HashMap
<
String
,
CacheImportFileStatus
>();
public
static
final
String
OKRMANAGER
=
"OKRManager"
;
public
static
QueueWorkDynamicRecord
queueWorkDynamicRecord
;
public
static
Context
context
()
{
...
...
@@ -32,12 +31,10 @@ public class ThisApplication {
public
static
void
init
()
{
try
{
Collaboration
.
start
(
ThisApplication
.
context
()
);
queueWorkDynamicRecord
=
new
QueueWorkDynamicRecord
();
context
().
startQueue
(
queueWorkDynamicRecord
);
context
().
startQueue
(
queueWorkDynamicRecord
);
new
OkrConfigSystemService
().
initAllSystemConfig
();
// 每天凌晨2点执行一次
...
...
@@ -62,13 +59,12 @@ public class ThisApplication {
public
static
void
destroy
()
{
try
{
Collaboration
.
stop
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
String
getOkrUserInfoCacheKey
(
String
personName
)
{
public
static
String
getOkrUserInfoCacheKey
(
String
personName
)
{
return
"OkrUserInfo.withPerson."
+
personName
;
}
...
...
o2server/x_okr_assemble_control/src/main/java/com/x/okr/assemble/control/service/OkrSendNotifyService.java
浏览文件 @
b9643db1
...
...
@@ -3,39 +3,33 @@ package com.x.okr.assemble.control.service;
import
java.util.List
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.collaboration.core.message.Collaboration
;
import
com.x.collaboration.core.message.notification.OkrCenterWorkDeployAcceptMessage
;
import
com.x.collaboration.core.message.notification.OkrWorkDeletedAcceptMessage
;
import
com.x.collaboration.core.message.notification.OkrWorkDeployAcceptMessage
;
import
com.x.collaboration.core.message.notification.OkrWorkGetAcceptMessage
;
import
com.x.collaboration.core.message.notification.OkrWorkReportDeletedAcceptMessage
;
import
com.x.okr.entity.OkrCenterWorkInfo
;
import
com.x.okr.entity.OkrWorkBaseInfo
;
import
com.x.okr.entity.OkrWorkReportBaseInfo
;
public
class
OkrSendNotifyService
{
/**
* 通知部署者中心工作部署完成
*
* @param OkrCenterWorkInfo
* @throws Exception
*/
public
void
notifyDeployerForCenterWorkDeploySuccess
(
OkrCenterWorkInfo
okrCenterWorkInfo
)
throws
Exception
{
if
(
okrCenterWorkInfo
!=
null
)
{
public
void
notifyDeployerForCenterWorkDeploySuccess
(
OkrCenterWorkInfo
okrCenterWorkInfo
)
throws
Exception
{
if
(
okrCenterWorkInfo
!=
null
)
{
String
targetName
=
okrCenterWorkInfo
.
getDeployerName
();
String
messageContent
=
"中心工作["
+
okrCenterWorkInfo
.
getTitle
()+
"]已经部署成功。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrCenterWorkDeployAcceptMessage
message
=
new
OkrCenterWorkDeployAcceptMessage
(
name
,
okrCenterWorkInfo
.
getId
(),
okrCenterWorkInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"中心工作["
+
okrCenterWorkInfo
.
getTitle
()
+
"]已经部署成功。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrCenterWorkDeployAcceptMessage message = new OkrCenterWorkDeployAcceptMessage( name, okrCenterWorkInfo.getId(), okrCenterWorkInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrCenterWorkInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrCenterWorkInfo is null, can not send message!"
);
}
}
...
...
@@ -45,21 +39,21 @@ public class OkrSendNotifyService {
* @param OkrCenterWorkInfo
* @throws Exception
*/
public
void
notifyDeployerForWorkDeploySuccess
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
public
void
notifyDeployerForWorkDeploySuccess
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
String
targetName
=
okrWorkBaseInfo
.
getDeployerName
();
String
messageContent
=
"工作["
+
okrWorkBaseInfo
.
getTitle
()+
"]已经部署成功。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkDeployAcceptMessage
message
=
new
OkrWorkDeployAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已经部署成功。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkDeployAcceptMessage message = new OkrWorkDeployAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
...
...
@@ -69,21 +63,21 @@ public class OkrSendNotifyService {
* @param okrWorkBaseInfo
* @throws Exception
*/
public
void
notifyResponsibilityForGetWork
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
public
void
notifyResponsibilityForGetWork
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
String
targetName
=
okrWorkBaseInfo
.
getResponsibilityEmployeeName
();
String
messageContent
=
"收到一个新的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"],请及时确认工作。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkGetAcceptMessage
message
=
new
OkrWorkGetAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"收到一个新的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"],请及时确认工作。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkGetAcceptMessage message = new OkrWorkGetAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
...
...
@@ -93,45 +87,47 @@ public class OkrSendNotifyService {
* @param okrWorkBaseInfo
* @throws Exception
*/
public
void
notifyCooperaterForGetWork
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
public
void
notifyCooperaterForGetWork
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
List
<
String
>
targetNames
=
okrWorkBaseInfo
.
getCooperateEmployeeNameList
();
String
messageContent
=
"收到一个需要您协助的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"],责任者:["
+
okrWorkBaseInfo
.
getResponsibilityEmployeeName
()+
"],请协助执行。"
;
if
(
ListTools
.
isNotEmpty
(
targetNames
)){
for
(
String
name
:
targetNames
){
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
()){
OkrWorkGetAcceptMessage
message
=
new
OkrWorkGetAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"收到一个需要您协助的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"],责任者:["
+
okrWorkBaseInfo
.
getResponsibilityEmployeeName
()
+
"],请协助执行。"
;
if
(
ListTools
.
isNotEmpty
(
targetNames
))
{
for
(
String
name
:
targetNames
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
// OkrWorkGetAcceptMessage message = new OkrWorkGetAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
// Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
/**
* 通知工作协助人工作已经被删除
*
* @param okrWorkBaseInfo
* @throws Exception
*/
public
void
notifyCooperaterForWorkDeleted
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
public
void
notifyCooperaterForWorkDeleted
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
List
<
String
>
targetNames
=
okrWorkBaseInfo
.
getCooperateEmployeeNameList
();
String
messageContent
=
"您协助的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被删除。"
;
if
(
ListTools
.
isNotEmpty
(
targetNames
))
{
for
(
String
name
:
targetNames
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkDeletedAcceptMessage
message
=
new
OkrWorkDeletedAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"您协助的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被删除。"
;
if
(
ListTools
.
isNotEmpty
(
targetNames
))
{
for
(
String
name
:
targetNames
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkDeletedAcceptMessage message = new OkrWorkDeletedAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
/**
* 通知部署者工作已被删除
*
...
...
@@ -139,66 +135,69 @@ public class OkrSendNotifyService {
* @throws Exception
*/
public
void
notifyDeployerForWorkDeletedSuccess
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
if
(
okrWorkBaseInfo
!=
null
)
{
String
targetName
=
okrWorkBaseInfo
.
getDeployerName
();
String
messageContent
=
"您部署的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被成功删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkDeletedAcceptMessage
message
=
new
OkrWorkDeletedAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"您部署的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被成功删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkDeletedAcceptMessage message = new OkrWorkDeletedAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
/**
* 通知工作主责人工作已经被删除
*
* @param okrWorkBaseInfo
* @throws Exception
*/
public
void
notifyResponsibilityForWorkDeleted
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
public
void
notifyResponsibilityForWorkDeleted
(
OkrWorkBaseInfo
okrWorkBaseInfo
)
throws
Exception
{
if
(
okrWorkBaseInfo
!=
null
)
{
String
targetName
=
okrWorkBaseInfo
.
getResponsibilityEmployeeName
();
String
messageContent
=
"您负责的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkDeletedAcceptMessage
message
=
new
OkrWorkDeletedAcceptMessage
(
name
,
okrWorkBaseInfo
.
getId
(),
okrWorkBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"您负责的工作["
+
okrWorkBaseInfo
.
getTitle
()
+
"]已被删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkDeletedAcceptMessage message = new OkrWorkDeletedAcceptMessage( name, okrWorkBaseInfo.getId(), okrWorkBaseInfo.getTitle(), messageContent );
//
Collaboration.send(message);
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkBaseInfo is null, can not send message!"
);
}
}
/**
* 通知操作人,汇报信息删除成功
*
* @param okrWorkReportBaseInfo
* @throws Exception
* @throws Exception
*/
public
void
notifyReportDeleteSuccess
(
OkrWorkReportBaseInfo
okrWorkReportBaseInfo
,
String
operator
)
throws
Exception
{
if
(
okrWorkReportBaseInfo
!=
null
){
public
void
notifyReportDeleteSuccess
(
OkrWorkReportBaseInfo
okrWorkReportBaseInfo
,
String
operator
)
throws
Exception
{
if
(
okrWorkReportBaseInfo
!=
null
)
{
String
targetName
=
operator
;
String
messageContent
=
"工作汇报["
+
okrWorkReportBaseInfo
.
getTitle
()
+
"]已成功删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
OkrWorkReportDeletedAcceptMessage
message
=
new
OkrWorkReportDeletedAcceptMessage
(
name
,
okrWorkReportBaseInfo
.
getId
(),
okrWorkReportBaseInfo
.
getTitle
(),
messageContent
);
Collaboration
.
send
(
message
);
String
messageContent
=
"工作汇报["
+
okrWorkReportBaseInfo
.
getTitle
()
+
"]已成功删除。"
;
if
(
targetName
!=
null
&&
!
targetName
.
isEmpty
())
{
String
[]
array
=
targetName
.
split
(
","
);
for
(
String
name
:
array
)
{
if
(
name
!=
null
&&
!
name
.
trim
().
isEmpty
())
{
//
OkrWorkReportDeletedAcceptMessage message = new OkrWorkReportDeletedAcceptMessage( name, okrWorkReportBaseInfo.getId(), okrWorkReportBaseInfo.getTitle(), messageContent );
//
Collaboration.send( message );
}
}
}
}
else
{
throw
new
Exception
(
"okrWorkReportBaseInfo is null, can not send message!"
);
}
else
{
throw
new
Exception
(
"okrWorkReportBaseInfo is null, can not send message!"
);
}
}
}
\ No newline at end of file
o2server/x_okr_assemble_control/src/main/webapp/jest/describe.js
浏览文件 @
b9643db1
var
Describe
=
function
()
{
//
20180730
//
20180730
}
Describe
.
splitValue
=
function
(
str
)
{
...
...
@@ -38,7 +38,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -55,7 +55,7 @@ Describe.doPost = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -74,7 +74,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
}).
always
(
function
(
resultJson
)
{
$
(
'
#result
'
).
html
(
JSON
.
stringify
(
resultJson
,
null
,
4
));
Describe
.
writeOut
(
m
.
outs
,
resultJson
);
...
...
@@ -91,7 +91,7 @@ Describe.doPut = function(address, m, data) {
xhrFields
:
{
'
withCredentials
'
:
true
},
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
?
JSON
.
stringify
(
data
)
:
data
)
data
:
((
m
.
contentType
.
indexOf
(
'
application/json
'
)
>
-
1
)
&&
(
!
m
.
useStringParameter
)
?
JSON
.
stringify
(
data
)
:
data
)
});
}
}
...
...
@@ -269,6 +269,14 @@ Describe.prototype = {
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
useStringParameter
)
{
txt
+=
'
<fieldset><legend>String</legend>
'
;
txt
+=
'
<table><tr><td>
'
;
txt
+=
'
<textarea id="string" style="height:300px; width:600px; padding:1px; border:1px #000000 solid"/>
'
;
txt
+=
'
</td><td>string</td></tr>
'
;
txt
+=
'
</table>
'
;
txt
+=
'
</fieldset>
'
;
}
if
(
m
.
outs
&&
m
.
outs
.
length
>
0
)
{
txt
+=
'
<fieldset id="outs"><legend>Out</legend>
'
;
txt
+=
'
<table>
'
;
...
...
@@ -318,6 +326,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPost
(
address
,
m
,
data
);
break
;
...
...
@@ -340,6 +350,8 @@ Describe.prototype = {
});
}
else
if
(
m
.
useJsonElementParameter
)
{
data
=
$
.
parseJSON
(
$
(
'
#jsonElement
'
).
val
());
}
else
if
(
m
.
useStringParameter
)
{
data
=
$
(
'
#string
'
).
val
();
}
Describe
.
doPut
(
address
,
m
,
data
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录