Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
d1b120c7
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1b120c7
编写于
4月 11, 2022
作者:
R
Ray
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix communicate
上级
aaa940c4
变更
58
展开全部
隐藏空白更改
内联
并排
Showing
58 changed file
with
2292 addition
and
2172 deletion
+2292
-2172
o2server/pom.xml
o2server/pom.xml
+1
-1
o2server/x_attendance_assemble_control/pom.xml
o2server/x_attendance_assemble_control/pom.xml
+9
-10
o2server/x_console/pom.xml
o2server/x_console/pom.xml
+0
-6
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/QiyeweixinConsumeQueue.java
.../message/assemble/communicate/QiyeweixinConsumeQueue.java
+0
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionList.java
...essage/assemble/communicate/jaxrs/consume/ActionList.java
+6
-6
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithCurrentPerson.java
...ommunicate/jaxrs/consume/ActionListWithCurrentPerson.java
+5
-6
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithPerson.java
...emble/communicate/jaxrs/consume/ActionListWithPerson.java
+6
-7
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionUpdate.java
...sage/assemble/communicate/jaxrs/consume/ActionUpdate.java
+6
-3
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionUpdateSingle.java
...ssemble/communicate/jaxrs/consume/ActionUpdateSingle.java
+4
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCancelTop.java
...ble/communicate/jaxrs/im/ActionConversationCancelTop.java
+29
-28
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCreate.java
...semble/communicate/jaxrs/im/ActionConversationCreate.java
+621
-614
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCreateByBusiness.java
...municate/jaxrs/im/ActionConversationCreateByBusiness.java
+37
-33
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationFindByBusinessId.java
...municate/jaxrs/im/ActionConversationFindByBusinessId.java
+34
-34
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationRead.java
...assemble/communicate/jaxrs/im/ActionConversationRead.java
+34
-31
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationSetTop.java
...semble/communicate/jaxrs/im/ActionConversationSetTop.java
+31
-28
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationUpdate.java
...semble/communicate/jaxrs/im/ActionConversationUpdate.java
+106
-108
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionDeleteConversationMsgs.java
...le/communicate/jaxrs/im/ActionDeleteConversationMsgs.java
+45
-41
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionFileDownload.java
...age/assemble/communicate/jaxrs/im/ActionFileDownload.java
+7
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionGetConversation.java
.../assemble/communicate/jaxrs/im/ActionGetConversation.java
+79
-79
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionImConfig.java
...message/assemble/communicate/jaxrs/im/ActionImConfig.java
+48
-42
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionImageDownloadWidthHeight.java
.../communicate/jaxrs/im/ActionImageDownloadWidthHeight.java
+9
-5
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java
...essage/assemble/communicate/jaxrs/im/ActionMsgCreate.java
+140
-150
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgListWithConversationByPage.java
...unicate/jaxrs/im/ActionMsgListWithConversationByPage.java
+41
-38
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgRevoke.java
...essage/assemble/communicate/jaxrs/im/ActionMsgRevoke.java
+45
-45
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMyConversationList.java
...semble/communicate/jaxrs/im/ActionMyConversationList.java
+81
-80
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionUploadFile.java
...ssage/assemble/communicate/jaxrs/im/ActionUploadFile.java
+91
-83
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionWriteImConfig.java
...ge/assemble/communicate/jaxrs/im/ActionWriteImConfig.java
+155
-157
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ImAction.java
...com/x/message/assemble/communicate/jaxrs/im/ImAction.java
+322
-334
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumed.java
...ommunicate/jaxrs/instant/ActionCurrentPersonConsumed.java
+11
-3
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
...unicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
+6
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListNext.java
...ge/assemble/communicate/jaxrs/instant/ActionListNext.java
+8
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListPrev.java
...ge/assemble/communicate/jaxrs/instant/ActionListPrev.java
+8
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
...unicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
...jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedDesc.java
...axrs/instant/ActionListWithCurrentPersonConsumedDesc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
...nicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
...rs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedDesc.java
...s/instant/ActionListWithCurrentPersonNotConsumedDesc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java
...xrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java
+4
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionCreate.java
...message/assemble/communicate/jaxrs/mass/ActionCreate.java
+13
-19
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionDelete.java
...message/assemble/communicate/jaxrs/mass/ActionDelete.java
+10
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionEnableType.java
...age/assemble/communicate/jaxrs/mass/ActionEnableType.java
+17
-4
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionGet.java
.../x/message/assemble/communicate/jaxrs/mass/ActionGet.java
+8
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionListNext.java
...ssage/assemble/communicate/jaxrs/mass/ActionListNext.java
+10
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionListPrev.java
...ssage/assemble/communicate/jaxrs/mass/ActionListPrev.java
+8
-0
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionCustomCreate.java
...ssemble/communicate/jaxrs/message/ActionCustomCreate.java
+8
-1
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionListPaging.java
.../assemble/communicate/jaxrs/message/ActionListPaging.java
+18
-7
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionConsumed.java
...essage/assemble/communicate/jaxrs/org/ActionConsumed.java
+9
-2
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionCreate.java
.../message/assemble/communicate/jaxrs/org/ActionCreate.java
+11
-24
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionDelete.java
.../message/assemble/communicate/jaxrs/org/ActionDelete.java
+16
-14
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionGet.java
...m/x/message/assemble/communicate/jaxrs/org/ActionGet.java
+9
-9
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListNext.java
...essage/assemble/communicate/jaxrs/org/ActionListNext.java
+9
-15
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListPrev.java
...essage/assemble/communicate/jaxrs/org/ActionListPrev.java
+10
-15
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListWithCriteria.java
...ssemble/communicate/jaxrs/org/ActionListWithCriteria.java
+40
-46
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionUpdateConsumed.java
.../assemble/communicate/jaxrs/org/ActionUpdateConsumed.java
+11
-5
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionUpdateReceiveSystem.java
...mble/communicate/jaxrs/org/ActionUpdateReceiveSystem.java
+23
-16
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
+9
-2
o2server/x_query_service_processing/pom.xml
o2server/x_query_service_processing/pom.xml
+0
-4
未找到文件。
o2server/pom.xml
浏览文件 @
d1b120c7
...
...
@@ -750,7 +750,7 @@
<dependency>
<groupId>
net.sourceforge.tess4j
</groupId>
<artifactId>
tess4j
</artifactId>
<version>
4.4
.0
</version>
<version>
5.2
.0
</version>
</dependency>
<dependency>
<groupId>
io.github.classgraph
</groupId>
...
...
o2server/x_attendance_assemble_control/pom.xml
浏览文件 @
d1b120c7
<?xml version="1.0"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
o2oa
</groupId>
...
...
@@ -24,15 +21,15 @@
<groupId>
o2oa
</groupId>
<artifactId>
x_organization_core_express
</artifactId>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_processplatform_core_entity
</artifactId>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_processplatform_core_entity
</artifactId>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_general_core_entity
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>
<plugin>
...
...
@@ -129,11 +126,13 @@
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-deploy-plugin
</artifactId>
<version>
3.0.0
</version>
<configuration>
<skip>
true
</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
\ No newline at end of file
o2server/x_console/pom.xml
浏览文件 @
d1b120c7
...
...
@@ -103,12 +103,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-deploy-plugin
</artifactId>
<configuration>
<skip>
true
</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/QiyeweixinConsumeQueue.java
浏览文件 @
d1b120c7
...
...
@@ -6,7 +6,6 @@ import org.apache.commons.lang3.StringUtils;
import
com.google.gson.Gson
;
import
com.google.gson.JsonObject
;
import
com.google.gson.JsonParser
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.Config
;
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionList.java
浏览文件 @
d1b120c7
...
...
@@ -13,6 +13,7 @@ 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.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
;
...
...
@@ -25,9 +26,11 @@ import com.x.message.core.entity.Message_;
class
ActionList
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionList
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionList
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
consume
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, consume:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
consume
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -43,14 +46,11 @@ class ActionList extends BaseAction {
CriteriaQuery
<
Message
>
cq
=
cb
.
createQuery
(
Message
.
class
);
Root
<
Message
>
root
=
cq
.
from
(
Message
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Message_
.
consumer
),
consume
);
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Message
_
.
createTime
))))
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
JpaObject
_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
/*
public static class Wi extends WsMessage {
}*/
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithCurrentPerson.java
浏览文件 @
d1b120c7
...
...
@@ -13,6 +13,7 @@ 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.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
;
...
...
@@ -25,9 +26,10 @@ import com.x.message.core.entity.Message_;
class
ActionListWithCurrentPerson
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPerson
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPerson
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
consume
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -45,14 +47,11 @@ class ActionListWithCurrentPerson extends BaseAction {
Root
<
Message
>
root
=
cq
.
from
(
Message
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Message_
.
consumer
),
consume
);
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Message_
.
person
),
name
));
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Message
_
.
createTime
))))
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
JpaObject
_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
/*
public static class Wi extends WsMessage {
}*/
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionListWithPerson.java
浏览文件 @
d1b120c7
...
...
@@ -14,6 +14,7 @@ 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.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
;
...
...
@@ -27,10 +28,12 @@ import com.x.message.core.entity.Message_;
class
ActionListWithPerson
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithPerson
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithPerson
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
consume
,
Integer
count
,
String
person
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, consume:{}, count:{}, person:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
consume
,
()
->
count
,
()
->
person
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
String
name
=
business
.
organization
().
person
().
get
(
person
);
...
...
@@ -51,15 +54,11 @@ class ActionListWithPerson extends BaseAction {
Root
<
Message
>
root
=
cq
.
from
(
Message
.
class
);
Predicate
p
=
cb
.
equal
(
root
.
get
(
Message_
.
consumer
),
consume
);
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Message_
.
person
),
name
));
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
Message
_
.
createTime
))))
p
=
cb
.
and
(
p
,
cb
.
isFalse
(
root
.
get
(
Message_
.
consumed
)
));
List
<
Message
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
).
orderBy
(
cb
.
asc
(
root
.
get
(
JpaObject
_
.
createTime
))))
.
setMaxResults
(
count
).
getResultList
();
return
Wo
.
copier
.
copy
(
os
);
}
/*
public static class Wi extends WsMessage {
}*/
public
static
class
Wo
extends
Message
{
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionUpdate.java
浏览文件 @
d1b120c7
...
...
@@ -17,9 +17,10 @@ import com.x.message.core.entity.Message;
class
ActionUpdate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionUpdate
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionUpdate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
type
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, type:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
type
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
...
...
@@ -27,7 +28,6 @@ class ActionUpdate extends BaseAction {
if
(!
os
.
isEmpty
())
{
emc
.
beginTransaction
(
Message
.
class
);
for
(
Message
o
:
os
)
{
// emc.remove(o);
o
.
setConsumed
(
true
);
}
emc
.
commit
();
...
...
@@ -41,8 +41,9 @@ class ActionUpdate extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
1919611450892520477L
;
@FieldDescribe
(
"标识"
)
List
<
String
>
idList
=
new
ArrayList
<>();
private
List
<
String
>
idList
=
new
ArrayList
<>();
public
List
<
String
>
getIdList
()
{
return
idList
;
...
...
@@ -56,6 +57,8 @@ class ActionUpdate extends BaseAction {
public
static
class
Wo
extends
WrapNumber
{
private
static
final
long
serialVersionUID
=
-
1122614087657833468L
;
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/consume/ActionUpdateSingle.java
浏览文件 @
d1b120c7
...
...
@@ -11,15 +11,15 @@ import com.x.message.core.entity.Message;
class
ActionUpdateSingle
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionUpdateSingle
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionUpdateSingle
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
type
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, type:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
type
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Message
message
=
emc
.
find
(
id
,
Message
.
class
);
if
(
null
!=
message
)
{
emc
.
beginTransaction
(
Message
.
class
);
// emc.remove(message);
message
.
setConsumed
(
true
);
emc
.
commit
();
}
...
...
@@ -32,6 +32,8 @@ class ActionUpdateSingle extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
8396900361845254097L
;
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCancelTop.java
浏览文件 @
d1b120c7
...
...
@@ -11,35 +11,36 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.IMConversationExt
;
public
class
ActionConversationCancelTop
extends
BaseAction
{
public
class
ActionConversationCancelTop
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationCancelTop
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationCancelTop
.
class
);
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setIsTop
(
false
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setIsTop
(
false
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, conversationId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setIsTop
(
false
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setIsTop
(
false
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCreate.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationCreateByBusiness.java
浏览文件 @
d1b120c7
...
...
@@ -17,47 +17,51 @@ import com.x.message.assemble.communicate.Business;
import
com.x.message.core.entity.IMConversation
;
/**
* Created by fancyLou on 2022/3/7.
* Copyright © 2022 O2. All rights reserved.
* Created by fancyLou on 2022/3/7. Copyright © 2022 O2. All rights reserved.
*/
public
class
ActionConversationCreateByBusiness
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationCreateByBusiness
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationCreateByBusiness
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
businessId
,
String
businessType
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
businessId
))
{
throw
new
ExceptionEmptyId
();
}
if
(
StringUtils
.
isEmpty
(
businessType
)
||
!(
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_PROCESS
)
||
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_CMS
)))
{
throw
new
ExceptionEmptyBusinessType
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
List
<
IMConversation
>
list
=
business
.
imConversationFactory
().
listConversationWithPersonAndBusinessId
(
effectivePerson
.
getDistinguishedName
(),
businessId
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
// 存在 返回结果
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
list
);
result
.
setData
(
wos
);
}
else
{
// 不存在 创建
if
(
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_PROCESS
))
{
//流程
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
businessId
,
String
businessType
)
throws
Exception
{
}
}
}
LOGGER
.
debug
(
"execute:{}, businessId:{}, businessType:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
businessId
,
()
->
businessType
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
businessId
))
{
throw
new
ExceptionEmptyId
();
}
if
(
StringUtils
.
isEmpty
(
businessType
)
||
!(
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_PROCESS
)
||
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_CMS
)))
{
throw
new
ExceptionEmptyBusinessType
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
List
<
IMConversation
>
list
=
business
.
imConversationFactory
()
.
listConversationWithPersonAndBusinessId
(
effectivePerson
.
getDistinguishedName
(),
businessId
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
// 存在 返回结果
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
list
);
result
.
setData
(
wos
);
}
else
{
// 不存在 创建
if
(
businessType
.
equals
(
IMConversation
.
CONVERSATION_BUSINESS_TYPE_PROCESS
))
{
// 流程
return
result
;
}
}
}
}
return
result
;
}
public
static
class
Wo
extends
IMConversation
{
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
5379640808709337246L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
private
static
final
long
serialVersionUID
=
5379640808709337246L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationFindByBusinessId.java
浏览文件 @
d1b120c7
...
...
@@ -18,39 +18,39 @@ import com.x.message.assemble.communicate.Business;
import
com.x.message.core.entity.IMConversation
;
/**
* Created by fancyLou on 2022/3/8.
* Copyright © 2022 O2. All rights reserved.
* Created by fancyLou on 2022/3/8. Copyright © 2022 O2. All rights reserved.
*/
public
class
ActionConversationFindByBusinessId
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationFindByBusinessId
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
businessId
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
businessId
))
{
throw
new
ExceptionEmptyId
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
List
<
IMConversation
>
list
=
business
.
imConversationFactory
().
listConversationWithPersonAndBusinessId
(
effectivePerson
.
getDistinguishedName
(),
businessId
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
// 存在 返回结果
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
list
);
result
.
setData
(
wos
);
}
else
{
result
.
setData
(
new
ArrayList
<>());
}
}
return
result
;
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
-
3327091155757964236L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
public
class
ActionConversationFindByBusinessId
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationFindByBusinessId
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
businessId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, businessId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
businessId
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
businessId
))
{
throw
new
ExceptionEmptyId
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
List
<
IMConversation
>
list
=
business
.
imConversationFactory
()
.
listConversationWithPersonAndBusinessId
(
effectivePerson
.
getDistinguishedName
(),
businessId
);
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
// 存在 返回结果
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
list
);
result
.
setData
(
wos
);
}
else
{
result
.
setData
(
new
ArrayList
<>());
}
}
return
result
;
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
-
3327091155757964236L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationRead.java
浏览文件 @
d1b120c7
...
...
@@ -13,35 +13,38 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.IMConversationExt
;
public
class
ActionConversationRead
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationRead
.
class
);
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setLastReadTime
(
new
Date
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setLastReadTime
(
new
Date
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
public
class
ActionConversationRead
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationRead
.
class
);
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, conversationId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setLastReadTime
(
new
Date
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setLastReadTime
(
new
Date
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationSetTop.java
浏览文件 @
d1b120c7
...
...
@@ -11,35 +11,38 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.IMConversationExt
;
public
class
ActionConversationSetTop
extends
BaseAction
{
public
class
ActionConversationSetTop
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationSetTop
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationSetTop
.
class
);
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setIsTop
(
true
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setIsTop
(
true
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
ActionResult
<
WoId
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
LOGGER
.
debug
(
"execute:{}, conversationId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
WoId
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
conversationId
);
if
(
ext
==
null
)
{
ext
=
new
IMConversationExt
();
ext
.
setConversationId
(
conversationId
);
ext
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
ext
.
setIsTop
(
true
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
else
{
ext
.
setIsTop
(
true
);
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
ext
,
CheckPersistType
.
all
);
emc
.
commit
();
}
WoId
woId
=
new
WoId
();
woId
.
setId
(
ext
.
getId
());
result
.
setData
(
woId
);
return
result
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionConversationUpdate.java
浏览文件 @
d1b120c7
...
...
@@ -22,115 +22,113 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.message.core.entity.IMConversation
;
public
class
ActionConversationUpdate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConversationUpdate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
logger
.
debug
(
"receive{}."
,
jsonElement
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
StringUtils
.
isEmpty
(
wi
.
getId
()))
{
throw
new
ExceptionEmptyId
();
}
IMConversation
conversation
=
emc
.
find
(
wi
.
getId
(),
IMConversation
.
class
);
if
(
conversation
.
getType
().
equals
(
CONVERSATION_TYPE_SINGLE
))
{
throw
new
ExceptionSingleConvNotUpdate
();
}
if
(!
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
throw
new
ExceptionConvUpdateNoPermission
();
}
emc
.
beginTransaction
(
IMConversation
.
class
);
if
(
StringUtils
.
isNotEmpty
(
wi
.
getTitle
()))
{
conversation
.
setTitle
(
wi
.
getTitle
());
}
if
(
StringUtils
.
isNotEmpty
(
wi
.
getNote
()))
{
conversation
.
setNote
(
wi
.
getNote
());
}
if
(
wi
.
getPersonList
()
!=
null
&&
!
wi
.
getPersonList
().
isEmpty
())
{
conversation
.
setPersonList
(
wi
.
getPersonList
());
if
(!
conversation
.
getPersonList
().
contains
(
effectivePerson
.
getDistinguishedName
()))
{
List
<
String
>
list
=
conversation
.
getPersonList
();
list
.
add
(
effectivePerson
.
getDistinguishedName
());
conversation
.
setPersonList
(
list
);
}
}
conversation
.
setUpdateTime
(
new
Date
());
emc
.
check
(
conversation
,
CheckPersistType
.
all
);
emc
.
commit
();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
conversation
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"id"
)
private
String
id
;
@FieldDescribe
(
"会话标题"
)
private
String
title
;
@FieldDescribe
(
"会话公告"
)
private
String
note
;
@FieldDescribe
(
"会话对象"
)
private
List
<
String
>
personList
;
@FieldDescribe
(
"会话管理员"
)
private
String
adminPerson
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getNote
()
{
return
note
;
}
public
void
setNote
(
String
note
)
{
this
.
note
=
note
;
}
public
List
<
String
>
getPersonList
()
{
return
personList
;
}
public
void
setPersonList
(
List
<
String
>
personList
)
{
this
.
personList
=
personList
;
}
public
String
getAdminPerson
()
{
return
adminPerson
;
}
public
void
setAdminPerson
(
String
adminPerson
)
{
this
.
adminPerson
=
adminPerson
;
}
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConversationUpdate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
StringUtils
.
isEmpty
(
wi
.
getId
()))
{
throw
new
ExceptionEmptyId
();
}
IMConversation
conversation
=
emc
.
find
(
wi
.
getId
(),
IMConversation
.
class
);
if
(
conversation
.
getType
().
equals
(
CONVERSATION_TYPE_SINGLE
))
{
throw
new
ExceptionSingleConvNotUpdate
();
}
if
(!
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
throw
new
ExceptionConvUpdateNoPermission
();
}
emc
.
beginTransaction
(
IMConversation
.
class
);
if
(
StringUtils
.
isNotEmpty
(
wi
.
getTitle
()))
{
conversation
.
setTitle
(
wi
.
getTitle
());
}
if
(
StringUtils
.
isNotEmpty
(
wi
.
getNote
()))
{
conversation
.
setNote
(
wi
.
getNote
());
}
if
(
wi
.
getPersonList
()
!=
null
&&
!
wi
.
getPersonList
().
isEmpty
())
{
conversation
.
setPersonList
(
wi
.
getPersonList
());
if
(!
conversation
.
getPersonList
().
contains
(
effectivePerson
.
getDistinguishedName
()))
{
List
<
String
>
list
=
conversation
.
getPersonList
();
list
.
add
(
effectivePerson
.
getDistinguishedName
());
conversation
.
setPersonList
(
list
);
}
}
conversation
.
setUpdateTime
(
new
Date
());
emc
.
check
(
conversation
,
CheckPersistType
.
all
);
emc
.
commit
();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
conversation
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
2252942380132685149L
;
@FieldDescribe
(
"id"
)
private
String
id
;
@FieldDescribe
(
"会话标题"
)
private
String
title
;
@FieldDescribe
(
"会话公告"
)
private
String
note
;
@FieldDescribe
(
"会话对象"
)
private
List
<
String
>
personList
;
@FieldDescribe
(
"会话管理员"
)
private
String
adminPerson
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getNote
()
{
return
note
;
}
public
void
setNote
(
String
note
)
{
this
.
note
=
note
;
}
public
List
<
String
>
getPersonList
()
{
return
personList
;
}
public
void
setPersonList
(
List
<
String
>
personList
)
{
this
.
personList
=
personList
;
}
public
String
getAdminPerson
()
{
return
adminPerson
;
}
public
void
setAdminPerson
(
String
adminPerson
)
{
this
.
adminPerson
=
adminPerson
;
}
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionDeleteConversationMsgs.java
浏览文件 @
d1b120c7
...
...
@@ -15,47 +15,51 @@ import com.x.message.assemble.communicate.Business;
import
com.x.message.core.entity.IMConversation
;
import
com.x.message.core.entity.IMMsg
;
public
class
ActionDeleteConversationMsgs
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDeleteConversationMsgs
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
conversationId
))
{
throw
new
ExceptionEmptyId
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wo
wo
=
new
Wo
();
Business
business
=
new
Business
(
emc
);
// 判断权限 群聊只有管理员能清空
IMConversation
conversation
=
emc
.
find
(
conversationId
,
IMConversation
.
class
);
if
(
conversation
==
null
)
{
throw
new
ExceptionConversationNotExist
();
}
if
(
conversation
.
getType
().
equals
(
IMConversation
.
CONVERSATION_TYPE_GROUP
)
&&
!
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
throw
new
ExceptionConvClearMsgsNoPermission
();
}
List
<
String
>
msgIds
=
business
.
imConversationFactory
().
listAllMsgIdsWithConversationId
(
conversationId
);
if
(
msgIds
==
null
||
msgIds
.
isEmpty
())
{
logger
.
info
(
"没有聊天记录,无需清空! conversationId:"
+
conversationId
);
}
else
{
// 这里是1条条删除的 优化一下?
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
delete
(
IMMsg
.
class
,
msgIds
);
emc
.
commit
();
logger
.
info
(
"成功清空聊天记录!conversationId:"
+
conversationId
+
" msg size:"
+
msgIds
.
size
()
+
" person:"
+
effectivePerson
.
getDistinguishedName
());
}
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
}
return
result
;
}
static
class
Wo
extends
WrapOutBoolean
{
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDeleteConversationMsgs
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, conversationId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
if
(
StringUtils
.
isEmpty
(
conversationId
))
{
throw
new
ExceptionEmptyId
();
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wo
wo
=
new
Wo
();
Business
business
=
new
Business
(
emc
);
// 判断权限 群聊只有管理员能清空
IMConversation
conversation
=
emc
.
find
(
conversationId
,
IMConversation
.
class
);
if
(
conversation
==
null
)
{
throw
new
ExceptionConversationNotExist
();
}
if
(
conversation
.
getType
().
equals
(
IMConversation
.
CONVERSATION_TYPE_GROUP
)
&&
!
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
throw
new
ExceptionConvClearMsgsNoPermission
();
}
List
<
String
>
msgIds
=
business
.
imConversationFactory
().
listAllMsgIdsWithConversationId
(
conversationId
);
if
(
msgIds
==
null
||
msgIds
.
isEmpty
())
{
LOGGER
.
info
(
"没有聊天记录,无需清空! conversationId:"
+
conversationId
);
}
else
{
// 这里是1条条删除的 优化一下?
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
delete
(
IMMsg
.
class
,
msgIds
);
emc
.
commit
();
LOGGER
.
info
(
"成功清空聊天记录!conversationId:"
+
conversationId
+
" msg size:"
+
msgIds
.
size
()
+
" person:"
+
effectivePerson
.
getDistinguishedName
());
}
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
}
return
result
;
}
static
class
Wo
extends
WrapOutBoolean
{
private
static
final
long
serialVersionUID
=
8378890042063582843L
;
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionFileDownload.java
浏览文件 @
d1b120c7
...
...
@@ -22,9 +22,12 @@ import com.x.message.core.entity.IMMsgFile;
*/
public
class
ActionFileDownload
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionFileDownload
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionFileDownload
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
...
...
@@ -56,7 +59,7 @@ public class ActionFileDownload extends BaseAction {
}
}
catch
(
Exception
e
)
{
if
(
e
.
getMessage
().
indexOf
(
"existed"
)
>
-
1
)
{
logger
.
warn
(
"原始附件{}-{}不存在,删除记录!"
,
file
.
getId
(),
file
.
getName
());
LOGGER
.
warn
(
"原始附件{}-{}不存在,删除记录!"
,
file
.
getId
(),
file
.
getName
());
emc
.
beginTransaction
(
IMMsgFile
.
class
);
emc
.
delete
(
IMMsgFile
.
class
,
file
.
getId
());
emc
.
commit
();
...
...
@@ -71,6 +74,8 @@ public class ActionFileDownload extends BaseAction {
public
static
class
Wo
extends
WoFile
{
private
static
final
long
serialVersionUID
=
4287911201461304784L
;
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
super
(
bytes
,
contentType
,
contentDisposition
);
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionGetConversation.java
浏览文件 @
d1b120c7
...
...
@@ -16,85 +16,85 @@ import com.x.message.core.entity.IMConversation;
import
com.x.message.core.entity.IMConversationExt
;
import
com.x.message.core.entity.IMMsg
;
public
class
ActionGetConversation
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionGetConversation
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversation
conversation
=
emc
.
find
(
conversationId
,
IMConversation
.
class
);
Wo
wo
=
Wo
.
copier
.
copy
(
conversation
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
wo
.
getId
());
if
(
ext
!=
null
)
{
wo
.
setIsTop
(
ext
.
getIsTop
());
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
ext
));
}
else
{
IMConversationExt
conversationExt
=
new
IMConversationExt
();
conversationExt
.
setConversationId
(
conversation
.
getId
());
conversationExt
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
conversationExt
,
CheckPersistType
.
all
);
emc
.
commit
();
wo
.
setIsTop
(
false
);
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
conversationExt
));
}
wo
.
setLastMessage
(
WoMsg
.
copier
.
copy
(
business
.
imConversationFactory
().
lastMessage
(
wo
.
getId
())));
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
-
1795342785531291824L
;
@FieldDescribe
(
"是否置顶."
)
private
Boolean
isTop
=
false
;
@FieldDescribe
(
"未读数量."
)
private
Long
unreadNumber
;
@FieldDescribe
(
"最后一条消息."
)
private
WoMsg
lastMessage
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
public
Boolean
getIsTop
()
{
return
isTop
;
}
public
void
setIsTop
(
Boolean
isTop
)
{
this
.
isTop
=
isTop
;
}
public
Long
getUnreadNumber
()
{
return
unreadNumber
;
}
public
void
setUnreadNumber
(
Long
unreadNumber
)
{
this
.
unreadNumber
=
unreadNumber
;
}
public
WoMsg
getLastMessage
()
{
return
lastMessage
;
}
public
void
setLastMessage
(
WoMsg
lastMessage
)
{
this
.
lastMessage
=
lastMessage
;
}
}
public
static
class
WoMsg
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
-
8403558908120739864L
;
static
WrapCopier
<
IMMsg
,
WoMsg
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
WoMsg
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionGetConversation
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, conversationId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
IMConversation
conversation
=
emc
.
find
(
conversationId
,
IMConversation
.
class
);
Wo
wo
=
Wo
.
copier
.
copy
(
conversation
);
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
wo
.
getId
());
if
(
ext
!=
null
)
{
wo
.
setIsTop
(
ext
.
getIsTop
());
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
ext
));
}
else
{
IMConversationExt
conversationExt
=
new
IMConversationExt
();
conversationExt
.
setConversationId
(
conversation
.
getId
());
conversationExt
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
conversationExt
,
CheckPersistType
.
all
);
emc
.
commit
();
wo
.
setIsTop
(
false
);
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
conversationExt
));
}
wo
.
setLastMessage
(
WoMsg
.
copier
.
copy
(
business
.
imConversationFactory
().
lastMessage
(
wo
.
getId
())));
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
IMConversation
{
private
static
final
long
serialVersionUID
=
-
1795342785531291824L
;
@FieldDescribe
(
"是否置顶."
)
private
Boolean
isTop
=
false
;
@FieldDescribe
(
"未读数量."
)
private
Long
unreadNumber
;
@FieldDescribe
(
"最后一条消息."
)
private
WoMsg
lastMessage
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
public
Boolean
getIsTop
()
{
return
isTop
;
}
public
void
setIsTop
(
Boolean
isTop
)
{
this
.
isTop
=
isTop
;
}
public
Long
getUnreadNumber
()
{
return
unreadNumber
;
}
public
void
setUnreadNumber
(
Long
unreadNumber
)
{
this
.
unreadNumber
=
unreadNumber
;
}
public
WoMsg
getLastMessage
()
{
return
lastMessage
;
}
public
void
setLastMessage
(
WoMsg
lastMessage
)
{
this
.
lastMessage
=
lastMessage
;
}
}
public
static
class
WoMsg
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
-
8403558908120739864L
;
static
WrapCopier
<
IMMsg
,
WoMsg
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
WoMsg
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionImConfig.java
浏览文件 @
d1b120c7
...
...
@@ -7,52 +7,58 @@ import com.x.base.core.project.annotation.FieldDescribe;
import
com.x.base.core.project.config.Config
;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
/**
* Created by fancyLou on 2022/2/18.
* Copyright © 2022 O2. All rights reserved.
* Created by fancyLou on 2022/2/18. Copyright © 2022 O2. All rights reserved.
*/
public
class
ActionImConfig
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionImConfig
.
class
);
ActionResult
<
ActionImConfig
.
Wo
>
execute
()
throws
Exception
{
ActionResult
<
ActionImConfig
.
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setEnableClearMsg
(
false
);
wo
.
setEnableRevokeMsg
(
false
);
for
(
Map
.
Entry
<
String
,
JsonElement
>
en
:
Config
.
web
().
entrySet
())
{
if
(
en
.
getKey
().
equals
(
IM_CONFIG_KEY_NAME
))
{
JsonElement
je
=
en
.
getValue
();
wo
=
this
.
convertToWrapIn
(
je
,
Wo
.
class
);
}
}
result
.
setData
(
wo
);
return
result
;
}
static
class
Wo
extends
GsonPropertyObject
{
@FieldDescribe
(
"是否开启清空聊天记录的功能."
)
private
Boolean
enableClearMsg
;
@FieldDescribe
(
"是否开启撤回聊天消息的功能."
)
private
Boolean
enableRevokeMsg
;
public
Boolean
getEnableClearMsg
()
{
return
enableClearMsg
;
}
public
void
setEnableClearMsg
(
Boolean
enableClearMsg
)
{
this
.
enableClearMsg
=
enableClearMsg
;
}
public
Boolean
getEnableRevokeMsg
()
{
return
enableRevokeMsg
;
}
public
void
setEnableRevokeMsg
(
Boolean
enableRevokeMsg
)
{
this
.
enableRevokeMsg
=
enableRevokeMsg
;
}
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionImConfig
.
class
);
ActionResult
<
ActionImConfig
.
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
ActionResult
<
ActionImConfig
.
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
wo
.
setEnableClearMsg
(
false
);
wo
.
setEnableRevokeMsg
(
false
);
for
(
Map
.
Entry
<
String
,
JsonElement
>
en
:
Config
.
web
().
entrySet
())
{
if
(
en
.
getKey
().
equals
(
IM_CONFIG_KEY_NAME
))
{
JsonElement
je
=
en
.
getValue
();
wo
=
this
.
convertToWrapIn
(
je
,
Wo
.
class
);
}
}
result
.
setData
(
wo
);
return
result
;
}
static
class
Wo
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
6217331123000062134L
;
@FieldDescribe
(
"是否开启清空聊天记录的功能."
)
private
Boolean
enableClearMsg
;
@FieldDescribe
(
"是否开启撤回聊天消息的功能."
)
private
Boolean
enableRevokeMsg
;
public
Boolean
getEnableClearMsg
()
{
return
enableClearMsg
;
}
public
void
setEnableClearMsg
(
Boolean
enableClearMsg
)
{
this
.
enableClearMsg
=
enableClearMsg
;
}
public
Boolean
getEnableRevokeMsg
()
{
return
enableRevokeMsg
;
}
public
void
setEnableRevokeMsg
(
Boolean
enableRevokeMsg
)
{
this
.
enableRevokeMsg
=
enableRevokeMsg
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionImageDownloadWidthHeight.java
浏览文件 @
d1b120c7
...
...
@@ -30,10 +30,14 @@ import com.x.message.core.entity.IMMsgFile;
*/
public
class
ActionImageDownloadWidthHeight
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionImageDownloadWidthHeight
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionImageDownloadWidthHeight
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
width
,
Integer
height
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, width:{}, height:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
width
,
()
->
height
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
null
;
...
...
@@ -43,13 +47,13 @@ public class ActionImageDownloadWidthHeight extends BaseAction {
throw
new
ExceptionFileNotExist
(
id
);
}
if
(!
ArrayUtils
.
contains
(
IMAGE_EXTENSIONS
,
file
.
getExtension
()))
{
throw
new
Exception
(
"file is not image file."
);
throw
new
IllegalState
Exception
(
"file is not image file."
);
}
if
(
width
<
0
||
width
>
5000
)
{
throw
new
Exception
(
"invalid width:"
+
width
+
"."
);
throw
new
IllegalState
Exception
(
"invalid width:"
+
width
+
"."
);
}
if
(
height
<
0
||
height
>
5000
)
{
throw
new
Exception
(
"invalid height:"
+
height
+
"."
);
throw
new
IllegalState
Exception
(
"invalid height:"
+
height
+
"."
);
}
CacheCategory
cacheCategory
=
new
CacheCategory
(
ActionImageDownloadWidthHeight
.
class
);
...
...
@@ -90,7 +94,7 @@ public class ActionImageDownloadWidthHeight extends BaseAction {
}
}
catch
(
Exception
e
)
{
if
(
e
.
getMessage
().
indexOf
(
"existed"
)
>
-
1
)
{
logger
.
warn
(
"原始附件{}-{}不存在,删除记录!"
,
file
.
getId
(),
file
.
getName
());
LOGGER
.
warn
(
"原始附件{}-{}不存在,删除记录!"
,
file
.
getId
(),
file
.
getName
());
emc
.
beginTransaction
(
IMMsgFile
.
class
);
emc
.
delete
(
IMMsgFile
.
class
,
file
.
getId
());
emc
.
commit
();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java
浏览文件 @
d1b120c7
...
...
@@ -3,6 +3,7 @@ package com.x.message.assemble.communicate.jaxrs.im;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.text.StringEscapeUtils
;
import
com.google.gson.JsonElement
;
...
...
@@ -24,157 +25,146 @@ import com.x.message.core.entity.IMConversation;
import
com.x.message.core.entity.IMMsg
;
import
com.x.message.core.entity.Message
;
public
class
ActionMsgCreate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionMsgCreate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
logger
.
debug
(
"receive{}."
,
jsonElement
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
IMMsg
msg
=
this
.
convertToWrapIn
(
jsonElement
,
IMMsg
.
class
);
if
(
msg
.
getConversationId
()
==
null
||
msg
.
getConversationId
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyConversationId
();
}
if
(
msg
.
getBody
()
==
null
||
msg
.
getBody
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyBody
();
}
msg
.
setCreatePerson
(
effectivePerson
.
getDistinguishedName
());
escapeHTML
(
msg
);
logger
.
info
(
"escape html json:"
+
msg
.
getBody
());
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
persist
(
msg
,
CheckPersistType
.
all
);
emc
.
commit
();
emc
.
beginTransaction
(
IMConversation
.
class
);
IMConversation
conversation
=
emc
.
find
(
msg
.
getConversationId
(),
IMConversation
.
class
);
conversation
.
setLastMessageTime
(
new
Date
());
emc
.
check
(
conversation
,
CheckPersistType
.
all
);
emc
.
commit
();
//发送消息
List
<
String
>
persons
=
conversation
.
getPersonList
();
persons
.
removeIf
(
s
->
(
effectivePerson
.
getDistinguishedName
().
equals
(
s
)));
for
(
int
i
=
0
;
i
<
persons
.
size
();
i
++)
{
String
name
=
""
;
try
{
name
=
effectivePerson
.
getDistinguishedName
().
substring
(
0
,
effectivePerson
.
getDistinguishedName
().
indexOf
(
"@"
));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
String
person
=
persons
.
get
(
i
);
logger
.
info
(
"发送im消息, person: "
+
person
);
String
title
=
"来自 "
+
name
+
" 的消息"
;
MessageConnector
.
send
(
MessageConnector
.
TYPE_IM_CREATE
,
title
,
person
,
msg
);
//如果消息接收者没有在线 连接ws 就发送一个推送消息
try
{
if
(!
ActionCollaboration
.
clients
.
containsValue
(
person
))
{
logger
.
info
(
"向app 推送im消息, person: "
+
person
);
Message
message
=
new
Message
();
String
body
=
imMessageBody
(
msg
);
message
.
setTitle
(
title
+
": "
+
body
);
message
.
setPerson
(
person
);
message
.
setType
(
MessageConnector
.
TYPE_IM_CREATE
);
message
.
setId
(
""
);
if
(
Config
.
communicate
().
pmsEnable
())
{
ThisApplication
.
pmsConsumeQueue
.
send
(
message
);
}
if
(
Config
.
pushConfig
().
getEnable
())
{
ThisApplication
.
pmsInnerConsumeQueue
.
send
(
message
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
msg
);
result
.
setData
(
wo
);
return
result
;
}
}
private
void
escapeHTML
(
IMMsg
msg
)
{
String
json
=
msg
.
getBody
();
IMMessageBody
body
=
gson
.
fromJson
(
json
,
IMMessageBody
.
class
);
if
(
"text"
.
equals
(
body
.
getType
()))
{
String
msgBody
=
body
.
getBody
();
String
msgBodyEscape
=
StringEscapeUtils
.
escapeHtml4
(
msgBody
);
logger
.
info
(
msgBodyEscape
);
body
.
setBody
(
msgBodyEscape
);
msg
.
setBody
(
gson
.
toJson
(
body
));
}
}
private
String
imMessageBody
(
IMMsg
msg
)
{
String
json
=
msg
.
getBody
();
IMMessageBody
body
=
gson
.
fromJson
(
json
,
IMMessageBody
.
class
);
if
(
"text"
.
equals
(
body
.
getType
()))
{
return
body
.
getBody
();
}
else
if
(
"emoji"
.
equals
(
body
.
getType
()))
{
return
"[表情]"
;
}
else
if
(
"image"
.
equals
(
body
.
getType
()))
{
return
"[图片]"
;
}
else
if
(
"audio"
.
equals
(
body
.
getType
()))
{
return
"[声音]"
;
}
else
if
(
"location"
.
equals
(
body
.
getType
()))
{
return
"[位置]"
;
}
else
if
(
"file"
.
equals
(
body
.
getType
()))
{
return
"[文件]"
;
}
else
if
(
"process"
.
equals
(
body
.
getType
()))
{
return
"[工作]"
;
}
else
if
(
"cms"
.
equals
(
body
.
getType
()))
{
return
"[信息]"
;
}
else
{
return
"[其它]"
;
}
}
public
static
class
Wo
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMMsg
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
public
static
class
IMMessageBody
{
/**
* text
* emoji
* image
* audio
* location
* file
* 20220315新增
* process
* cms
*/
private
String
type
;
private
String
body
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionMsgCreate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"effectivePerson:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
IMMsg
msg
=
this
.
convertToWrapIn
(
jsonElement
,
IMMsg
.
class
);
if
(
msg
.
getConversationId
()
==
null
||
msg
.
getConversationId
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyConversationId
();
}
if
(
msg
.
getBody
()
==
null
||
msg
.
getBody
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyBody
();
}
msg
.
setCreatePerson
(
effectivePerson
.
getDistinguishedName
());
escapeHTML
(
msg
);
LOGGER
.
info
(
"escape html json:"
+
msg
.
getBody
());
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
persist
(
msg
,
CheckPersistType
.
all
);
emc
.
commit
();
emc
.
beginTransaction
(
IMConversation
.
class
);
IMConversation
conversation
=
emc
.
find
(
msg
.
getConversationId
(),
IMConversation
.
class
);
conversation
.
setLastMessageTime
(
new
Date
());
emc
.
check
(
conversation
,
CheckPersistType
.
all
);
emc
.
commit
();
// 发送消息
List
<
String
>
persons
=
conversation
.
getPersonList
();
persons
.
removeIf
(
s
->
(
effectivePerson
.
getDistinguishedName
().
equals
(
s
)));
for
(
int
i
=
0
;
i
<
persons
.
size
();
i
++)
{
String
name
=
""
;
try
{
name
=
effectivePerson
.
getDistinguishedName
().
substring
(
0
,
effectivePerson
.
getDistinguishedName
().
indexOf
(
"@"
));
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
String
person
=
persons
.
get
(
i
);
LOGGER
.
info
(
"发送im消息, person: "
+
person
);
String
title
=
"来自 "
+
name
+
" 的消息"
;
MessageConnector
.
send
(
MessageConnector
.
TYPE_IM_CREATE
,
title
,
person
,
msg
);
// 如果消息接收者没有在线 连接ws 就发送一个推送消息
try
{
if
(!
ActionCollaboration
.
clients
.
containsValue
(
person
))
{
LOGGER
.
info
(
"向app 推送im消息, person: "
+
person
);
Message
message
=
new
Message
();
String
body
=
imMessageBody
(
msg
);
message
.
setTitle
(
title
+
": "
+
body
);
message
.
setPerson
(
person
);
message
.
setType
(
MessageConnector
.
TYPE_IM_CREATE
);
message
.
setId
(
""
);
if
(
BooleanUtils
.
isTrue
(
Config
.
communicate
().
pmsEnable
()))
{
ThisApplication
.
pmsConsumeQueue
.
send
(
message
);
}
if
(
BooleanUtils
.
isTrue
(
Config
.
pushConfig
().
getEnable
()))
{
ThisApplication
.
pmsInnerConsumeQueue
.
send
(
message
);
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
}
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
msg
);
result
.
setData
(
wo
);
return
result
;
}
}
private
void
escapeHTML
(
IMMsg
msg
)
{
String
json
=
msg
.
getBody
();
IMMessageBody
body
=
gson
.
fromJson
(
json
,
IMMessageBody
.
class
);
if
(
"text"
.
equals
(
body
.
getType
()))
{
String
msgBody
=
body
.
getBody
();
String
msgBodyEscape
=
StringEscapeUtils
.
escapeHtml4
(
msgBody
);
LOGGER
.
info
(
msgBodyEscape
);
body
.
setBody
(
msgBodyEscape
);
msg
.
setBody
(
gson
.
toJson
(
body
));
}
}
private
String
imMessageBody
(
IMMsg
msg
)
{
String
json
=
msg
.
getBody
();
IMMessageBody
body
=
gson
.
fromJson
(
json
,
IMMessageBody
.
class
);
if
(
"text"
.
equals
(
body
.
getType
()))
{
return
body
.
getBody
();
}
else
if
(
"emoji"
.
equals
(
body
.
getType
()))
{
return
"[表情]"
;
}
else
if
(
"image"
.
equals
(
body
.
getType
()))
{
return
"[图片]"
;
}
else
if
(
"audio"
.
equals
(
body
.
getType
()))
{
return
"[声音]"
;
}
else
if
(
"location"
.
equals
(
body
.
getType
()))
{
return
"[位置]"
;
}
else
if
(
"file"
.
equals
(
body
.
getType
()))
{
return
"[文件]"
;
}
else
if
(
"process"
.
equals
(
body
.
getType
()))
{
return
"[工作]"
;
}
else
if
(
"cms"
.
equals
(
body
.
getType
()))
{
return
"[信息]"
;
}
else
{
return
"[其它]"
;
}
}
public
static
class
Wo
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMMsg
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
public
static
class
IMMessageBody
{
/**
* text emoji image audio location file 20220315新增 process cms
*/
private
String
type
;
private
String
body
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgListWithConversationByPage.java
浏览文件 @
d1b120c7
...
...
@@ -17,53 +17,56 @@ import com.x.base.core.project.logger.LoggerFactory;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.IMMsg
;
public
class
ActionMsgListWithConversationByPage
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionMsgListWithConversationByPage
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionMsgListWithConversationByPage
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, page:{}, size:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
page
,
()
->
size
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
wi
==
null
)
{
wi
=
new
Wi
();
}
if
(
wi
.
getConversationId
()
==
null
||
wi
.
getConversationId
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyConversationId
();
}
Integer
adjustPage
=
this
.
adjustPage
(
page
);
Integer
adjustPageSize
=
this
.
adjustSize
(
size
);
List
<
IMMsg
>
msgList
=
business
.
imConversationFactory
().
listMsgWithConversationByPage
(
adjustPage
,
adjustPageSize
,
wi
.
getConversationId
());
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
msgList
);
result
.
setData
(
wos
);
result
.
setCount
(
business
.
imConversationFactory
().
count
(
wi
.
getConversationId
()));
return
result
;
}
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
wi
==
null
)
{
wi
=
new
Wi
();
}
if
(
wi
.
getConversationId
()
==
null
||
wi
.
getConversationId
().
isEmpty
())
{
throw
new
ExceptionMsgEmptyConversationId
();
}
Integer
adjustPage
=
this
.
adjustPage
(
page
);
Integer
adjustPageSize
=
this
.
adjustSize
(
size
);
List
<
IMMsg
>
msgList
=
business
.
imConversationFactory
().
listMsgWithConversationByPage
(
adjustPage
,
adjustPageSize
,
wi
.
getConversationId
());
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
msgList
);
result
.
setData
(
wos
);
result
.
setCount
(
business
.
imConversationFactory
().
count
(
wi
.
getConversationId
()));
return
result
;
}
}
public
class
Wi
extends
GsonPropertyObject
{
public
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"会话id"
)
private
String
conversationId
;
private
static
final
long
serialVersionUID
=
33404493425589133L
;
@FieldDescribe
(
"会话id"
)
private
String
conversationId
;
public
String
getConversationId
()
{
return
conversationId
;
}
public
String
getConversationId
()
{
return
conversationId
;
}
public
void
setConversationId
(
String
conversationId
)
{
this
.
conversationId
=
conversationId
;
}
}
public
void
setConversationId
(
String
conversationId
)
{
this
.
conversationId
=
conversationId
;
}
}
public
static
class
Wo
extends
IMMsg
{
public
static
class
Wo
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMMsg
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMMsg
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgRevoke.java
浏览文件 @
d1b120c7
...
...
@@ -11,53 +11,53 @@ import com.x.message.core.entity.IMConversation;
import
com.x.message.core.entity.IMMsg
;
/**
* Created by fancyLou on 2022/2/15.
* Copyright © 2022 O2. All rights reserved.
* Created by fancyLou on 2022/2/15. Copyright © 2022 O2. All rights reserved.
*/
public
class
ActionMsgRevoke
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionMsgRevoke
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
IMMsg
imMsg
=
emc
.
find
(
id
,
IMMsg
.
class
);
if
(
imMsg
==
null
)
{
throw
new
ExceptionMsgNotfound
();
}
IMConversation
conversation
=
emc
.
find
(
imMsg
.
getConversationId
(),
IMConversation
.
class
);
if
(
conversation
==
null
)
{
throw
new
ExceptionConversationNotExist
();
}
boolean
canRevoke
=
false
;
// 群组 管理员可以撤回
if
(
conversation
.
getType
().
equals
(
IMConversation
.
CONVERSATION_TYPE_GROUP
))
{
if
(
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
canRevoke
=
true
;
}
}
// 群组 个人 如果是自己发送的消息 都可以撤回
if
(
effectivePerson
.
getDistinguishedName
().
equals
(
imMsg
.
getCreatePerson
()))
{
canRevoke
=
true
;
}
if
(!
canRevoke
)
{
throw
new
ExceptionMsgRevokeNoPermission
();
}
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
remove
(
imMsg
);
emc
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
id
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionMsgRevoke
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
IMMsg
imMsg
=
emc
.
find
(
id
,
IMMsg
.
class
);
if
(
imMsg
==
null
)
{
throw
new
ExceptionMsgNotfound
();
}
IMConversation
conversation
=
emc
.
find
(
imMsg
.
getConversationId
(),
IMConversation
.
class
);
if
(
conversation
==
null
)
{
throw
new
ExceptionConversationNotExist
();
}
boolean
canRevoke
=
false
;
// 群组 管理员可以撤回
if
(
conversation
.
getType
().
equals
(
IMConversation
.
CONVERSATION_TYPE_GROUP
)
&&
effectivePerson
.
getDistinguishedName
().
equals
(
conversation
.
getAdminPerson
()))
{
canRevoke
=
true
;
}
// 群组 个人 如果是自己发送的消息 都可以撤回
if
(
effectivePerson
.
getDistinguishedName
().
equals
(
imMsg
.
getCreatePerson
()))
{
canRevoke
=
true
;
}
if
(!
canRevoke
)
{
throw
new
ExceptionMsgRevokeNoPermission
();
}
emc
.
beginTransaction
(
IMMsg
.
class
);
emc
.
remove
(
imMsg
);
emc
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
id
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
-
7131151548796015519L
;
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMyConversationList.java
浏览文件 @
d1b120c7
...
...
@@ -18,86 +18,87 @@ import com.x.message.core.entity.IMConversation;
import
com.x.message.core.entity.IMConversationExt
;
import
com.x.message.core.entity.IMMsg
;
public
class
ActionMyConversationList
extends
BaseAction
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionMyConversationList
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
List
<
String
>
ids
=
business
.
imConversationFactory
().
listConversationWithPerson
(
effectivePerson
.
getDistinguishedName
());
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
emc
.
list
(
IMConversation
.
class
,
ids
));
for
(
Wo
wo
:
wos
)
{
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
wo
.
getId
());
if
(
ext
!=
null
)
{
wo
.
setIsTop
(
ext
.
getIsTop
());
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
ext
));
}
else
{
IMConversationExt
conversationExt
=
new
IMConversationExt
();
conversationExt
.
setConversationId
(
wo
.
getId
());
conversationExt
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
conversationExt
,
CheckPersistType
.
all
);
emc
.
commit
();
wo
.
setIsTop
(
false
);
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
conversationExt
));
}
wo
.
setLastMessage
(
WoMsg
.
copier
.
copy
(
business
.
imConversationFactory
().
lastMessage
(
wo
.
getId
())));
}
result
.
setData
(
wos
);
return
result
;
}
}
public
static
class
Wo
extends
IMConversation
{
@FieldDescribe
(
"是否置顶."
)
private
Boolean
isTop
=
false
;
@FieldDescribe
(
"未读数量."
)
private
Long
unreadNumber
;
@FieldDescribe
(
"最后一条消息."
)
private
WoMsg
lastMessage
;
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
public
Boolean
getIsTop
()
{
return
isTop
;
}
public
void
setIsTop
(
Boolean
isTop
)
{
this
.
isTop
=
isTop
;
}
public
Long
getUnreadNumber
()
{
return
unreadNumber
;
}
public
void
setUnreadNumber
(
Long
unreadNumber
)
{
this
.
unreadNumber
=
unreadNumber
;
}
public
WoMsg
getLastMessage
()
{
return
lastMessage
;
}
public
void
setLastMessage
(
WoMsg
lastMessage
)
{
this
.
lastMessage
=
lastMessage
;
}
}
public
static
class
WoMsg
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
5910475322522970446L
;
static
WrapCopier
<
IMMsg
,
WoMsg
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
WoMsg
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionMyConversationList
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
List
<
String
>
ids
=
business
.
imConversationFactory
()
.
listConversationWithPerson
(
effectivePerson
.
getDistinguishedName
());
List
<
Wo
>
wos
=
Wo
.
copier
.
copy
(
emc
.
list
(
IMConversation
.
class
,
ids
));
for
(
Wo
wo
:
wos
)
{
IMConversationExt
ext
=
business
.
imConversationFactory
()
.
getConversationExt
(
effectivePerson
.
getDistinguishedName
(),
wo
.
getId
());
if
(
ext
!=
null
)
{
wo
.
setIsTop
(
ext
.
getIsTop
());
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
ext
));
}
else
{
IMConversationExt
conversationExt
=
new
IMConversationExt
();
conversationExt
.
setConversationId
(
wo
.
getId
());
conversationExt
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
emc
.
beginTransaction
(
IMConversationExt
.
class
);
emc
.
persist
(
conversationExt
,
CheckPersistType
.
all
);
emc
.
commit
();
wo
.
setIsTop
(
false
);
wo
.
setUnreadNumber
(
business
.
imConversationFactory
().
unreadNumber
(
conversationExt
));
}
wo
.
setLastMessage
(
WoMsg
.
copier
.
copy
(
business
.
imConversationFactory
().
lastMessage
(
wo
.
getId
())));
}
result
.
setData
(
wos
);
return
result
;
}
}
public
static
class
Wo
extends
IMConversation
{
@FieldDescribe
(
"是否置顶."
)
private
Boolean
isTop
=
false
;
@FieldDescribe
(
"未读数量."
)
private
Long
unreadNumber
;
@FieldDescribe
(
"最后一条消息."
)
private
WoMsg
lastMessage
;
private
static
final
long
serialVersionUID
=
3434938936805201380L
;
static
WrapCopier
<
IMConversation
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
IMConversation
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
public
Boolean
getIsTop
()
{
return
isTop
;
}
public
void
setIsTop
(
Boolean
isTop
)
{
this
.
isTop
=
isTop
;
}
public
Long
getUnreadNumber
()
{
return
unreadNumber
;
}
public
void
setUnreadNumber
(
Long
unreadNumber
)
{
this
.
unreadNumber
=
unreadNumber
;
}
public
WoMsg
getLastMessage
()
{
return
lastMessage
;
}
public
void
setLastMessage
(
WoMsg
lastMessage
)
{
this
.
lastMessage
=
lastMessage
;
}
}
public
static
class
WoMsg
extends
IMMsg
{
private
static
final
long
serialVersionUID
=
5910475322522970446L
;
static
WrapCopier
<
IMMsg
,
WoMsg
>
copier
=
WrapCopierFactory
.
wo
(
IMMsg
.
class
,
WoMsg
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionUploadFile.java
浏览文件 @
d1b120c7
package
com.x.message.assemble.communicate.jaxrs.im
;
import
java.util.Date
;
import
java.util.Objects
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -14,95 +15,102 @@ import com.x.base.core.project.config.StorageMapping;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DefaultCharset
;
import
com.x.message.assemble.communicate.ThisApplication
;
import
com.x.message.core.entity.IMMsgFile
;
/**
* Created by fancyLou on 2020-06-15.
* Copyright © 2020 O2. All rights reserved.
* Created by fancyLou on 2020-06-15. Copyright © 2020 O2. All rights reserved.
*/
public
class
ActionUploadFile
extends
BaseAction
{
public
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
,
String
type
,
String
fileName
,
byte
[]
bytes
,
FormDataContentDisposition
disposition
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
IMMsgFile
.
class
);
if
(
null
==
mapping
)
{
throw
new
ExceptionAllocateStorageMaaping
();
}
/** 文件名编码转换 */
if
(
StringUtils
.
isEmpty
(
fileName
))
{
try
{
fileName
=
new
String
(
disposition
.
getFileName
().
getBytes
(
DefaultCharset
.
charset_iso_8859_1
),
DefaultCharset
.
charset
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
fileName
=
FilenameUtils
.
getName
(
fileName
);
if
(
StringUtils
.
isEmpty
(
fileName
))
{
throw
new
ExceptionFileNameEmpty
();
}
/** 禁止不带扩展名的文件上传 */
if
(
StringUtils
.
isEmpty
(
FilenameUtils
.
getExtension
(
fileName
)))
{
throw
new
ExceptionEmptyExtension
(
fileName
);
}
if
(
bytes
==
null
){
throw
new
ExceptionAttachmentNone
(
fileName
);
}
IMMsgFile
file
=
new
IMMsgFile
();
file
.
setName
(
fileName
);
file
.
setStorage
(
mapping
.
getName
());
file
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
Date
now
=
new
Date
();
file
.
setCreateTime
(
now
);
file
.
setLastUpdateTime
(
now
);
file
.
setExtension
(
StringUtils
.
lowerCase
(
FilenameUtils
.
getExtension
(
fileName
)));
file
.
setConversationId
(
conversationId
);
file
.
setType
(
type
);
emc
.
check
(
file
,
CheckPersistType
.
all
);
file
.
saveContent
(
mapping
,
bytes
,
fileName
);
emc
.
beginTransaction
(
IMMsgFile
.
class
);
emc
.
persist
(
file
);
emc
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
file
.
getId
());
wo
.
setFileExtension
(
file
.
getExtension
());
wo
.
setFileName
(
fileName
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
@FieldDescribe
(
"文件扩展名"
)
private
String
fileExtension
;
@FieldDescribe
(
"文件名"
)
private
String
fileName
;
public
String
getFileExtension
()
{
return
fileExtension
;
}
public
void
setFileExtension
(
String
fileExtension
)
{
this
.
fileExtension
=
fileExtension
;
}
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionUploadFile
.
class
);
public
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
conversationId
,
String
type
,
String
fileName
,
byte
[]
bytes
,
FormDataContentDisposition
disposition
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, conversationId:{}, type:{}, fileName:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
conversationId
,
()
->
type
,
()
->
Objects
.
toString
(
fileName
));
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
IMMsgFile
.
class
);
if
(
null
==
mapping
)
{
throw
new
ExceptionAllocateStorageMaaping
();
}
String
name
=
fileName
;
/** 文件名编码转换 */
if
(
StringUtils
.
isEmpty
(
name
))
{
try
{
name
=
new
String
(
disposition
.
getFileName
().
getBytes
(
DefaultCharset
.
charset_iso_8859_1
),
DefaultCharset
.
charset
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
name
=
FilenameUtils
.
getName
(
name
);
if
(
StringUtils
.
isEmpty
(
name
))
{
throw
new
ExceptionFileNameEmpty
();
}
/** 禁止不带扩展名的文件上传 */
if
(
StringUtils
.
isEmpty
(
FilenameUtils
.
getExtension
(
name
)))
{
throw
new
ExceptionEmptyExtension
(
name
);
}
if
(
bytes
==
null
)
{
throw
new
ExceptionAttachmentNone
(
name
);
}
IMMsgFile
file
=
new
IMMsgFile
();
file
.
setName
(
name
);
file
.
setStorage
(
mapping
.
getName
());
file
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
Date
now
=
new
Date
();
file
.
setCreateTime
(
now
);
file
.
setLastUpdateTime
(
now
);
file
.
setExtension
(
StringUtils
.
lowerCase
(
FilenameUtils
.
getExtension
(
name
)));
file
.
setConversationId
(
conversationId
);
file
.
setType
(
type
);
emc
.
check
(
file
,
CheckPersistType
.
all
);
file
.
saveContent
(
mapping
,
bytes
,
name
);
emc
.
beginTransaction
(
IMMsgFile
.
class
);
emc
.
persist
(
file
);
emc
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setId
(
file
.
getId
());
wo
.
setFileExtension
(
file
.
getExtension
());
wo
.
setFileName
(
name
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
2329781058340372108L
;
@FieldDescribe
(
"文件扩展名"
)
private
String
fileExtension
;
@FieldDescribe
(
"文件名"
)
private
String
fileName
;
public
String
getFileExtension
()
{
return
fileExtension
;
}
public
void
setFileExtension
(
String
fileExtension
)
{
this
.
fileExtension
=
fileExtension
;
}
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionWriteImConfig.java
浏览文件 @
d1b120c7
...
...
@@ -18,170 +18,168 @@ import com.x.base.core.project.logger.LoggerFactory;
public
class
ActionWriteImConfig
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionWriteImConfig
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<
Wo
>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
LinkedHashMap
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
for
(
Map
.
Entry
<
String
,
JsonElement
>
en
:
Config
.
web
().
entrySet
())
{
map
.
put
(
en
.
getKey
(),
en
.
getValue
());
}
map
.
put
(
IM_CONFIG_KEY_NAME
,
wi
);
String
content
=
gson
.
toJson
(
map
);
String
fileName
=
"web.json"
;
logger
.
info
(
"更新配置文件。。。。。。。。。。。。。。"
);
logger
.
info
(
"文件:"
+
fileName
);
logger
.
info
(
"内容:"
+
content
);
WebConfigSaveWi
saveWi
=
new
WebConfigSaveWi
();
saveWi
.
setFileName
(
fileName
);
saveWi
.
setFileContent
(
content
);
ActionResponse
response
=
CipherConnectionAction
.
post
(
false
,
Config
.
url_x_program_center_jaxrs
(
"config"
,
"save"
),
saveWi
);
Wo
wo
=
new
Wo
();
if
(
response
!=
null
)
{
SaveConfigWo
saveWo
=
response
.
getData
(
SaveConfigWo
.
class
);
if
(
saveWo
!=
null
&&
saveWo
.
getStatus
()
!=
null
)
{
logger
.
info
(
"修改保存["
+
fileName
+
"]配置文件成功!"
);
try
{
WebServers
.
updateWebServerConfigJson
();
logger
.
info
(
"更新 config.json 成功!!!!"
);
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"更新前端 config.json 出错"
);
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
logger
.
error
(
e
);
}
}
else
{
logger
.
info
(
"保存["
+
fileName
+
"]配置文件data返回为空!!!!"
);
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
}
}
else
{
logger
.
info
(
"保存["
+
fileName
+
"]配置文件 返回为空!!"
);
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
}
return
result
;
}
public
static
class
WebConfigSaveWi
extends
GsonPropertyObject
{
private
String
fileName
;
private
String
fileContent
;
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
String
getFileContent
()
{
return
fileContent
;
}
public
void
setFileContent
(
String
fileContent
)
{
this
.
fileContent
=
fileContent
;
}
}
/**
* IM的配置文件,这个配置文件默认写入到 web.json key=imConfig
*/
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"是否开启清空聊天记录的功能."
)
private
Boolean
enableClearMsg
;
@FieldDescribe
(
"是否开启撤回聊天消息的功能."
)
private
Boolean
enableRevokeMsg
;
public
Boolean
getEnableClearMsg
()
{
return
enableClearMsg
;
}
public
void
setEnableClearMsg
(
Boolean
enableClearMsg
)
{
this
.
enableClearMsg
=
enableClearMsg
;
}
public
Boolean
getEnableRevokeMsg
()
{
return
enableRevokeMsg
;
}
public
void
setEnableRevokeMsg
(
Boolean
enableRevokeMsg
)
{
this
.
enableRevokeMsg
=
enableRevokeMsg
;
}
}
static
class
Wo
extends
WrapOutBoolean
{
}
public
static
class
SaveConfigWo
extends
GsonPropertyObject
{
@FieldDescribe
(
"执行时间"
)
private
String
time
;
@FieldDescribe
(
"执行结果"
)
private
String
status
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionWriteImConfig
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<
Wo
>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
LinkedHashMap
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
for
(
Map
.
Entry
<
String
,
JsonElement
>
en
:
Config
.
web
().
entrySet
())
{
map
.
put
(
en
.
getKey
(),
en
.
getValue
());
}
map
.
put
(
IM_CONFIG_KEY_NAME
,
wi
);
String
content
=
gson
.
toJson
(
map
);
String
fileName
=
"web.json"
;
WebConfigSaveWi
saveWi
=
new
WebConfigSaveWi
();
saveWi
.
setFileName
(
fileName
);
saveWi
.
setFileContent
(
content
);
ActionResponse
response
=
CipherConnectionAction
.
post
(
false
,
Config
.
url_x_program_center_jaxrs
(
"config"
,
"save"
),
saveWi
);
Wo
wo
=
new
Wo
();
if
(
response
!=
null
)
{
SaveConfigWo
saveWo
=
response
.
getData
(
SaveConfigWo
.
class
);
if
(
saveWo
!=
null
&&
saveWo
.
getStatus
()
!=
null
)
{
try
{
WebServers
.
updateWebServerConfigJson
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
}
catch
(
Exception
e
)
{
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
LOGGER
.
error
(
e
);
}
}
else
{
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
}
}
else
{
wo
.
setValue
(
false
);
result
.
setData
(
wo
);
}
return
result
;
}
public
static
class
WebConfigSaveWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
7474510912629527669L
;
private
String
fileName
;
private
String
fileContent
;
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
String
getFileContent
()
{
return
fileContent
;
}
public
void
setFileContent
(
String
fileContent
)
{
this
.
fileContent
=
fileContent
;
}
}
/**
* IM的配置文件,这个配置文件默认写入到 web.json key=imConfig
*/
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
8090262801050845005L
;
@FieldDescribe
(
"是否开启清空聊天记录的功能."
)
private
Boolean
enableClearMsg
;
@FieldDescribe
(
"是否开启撤回聊天消息的功能."
)
private
Boolean
enableRevokeMsg
;
public
Boolean
getEnableClearMsg
()
{
return
enableClearMsg
;
}
public
void
setEnableClearMsg
(
Boolean
enableClearMsg
)
{
this
.
enableClearMsg
=
enableClearMsg
;
}
public
Boolean
getEnableRevokeMsg
()
{
return
enableRevokeMsg
;
}
public
void
setEnableRevokeMsg
(
Boolean
enableRevokeMsg
)
{
this
.
enableRevokeMsg
=
enableRevokeMsg
;
}
}
static
class
Wo
extends
WrapOutBoolean
{
private
static
final
long
serialVersionUID
=
5620692994281685875L
;
}
public
static
class
SaveConfigWo
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
2114718746836340460L
;
@FieldDescribe
(
"执行时间"
)
private
String
time
;
@FieldDescribe
(
"执行结果"
)
private
String
status
;
@FieldDescribe
(
"执行消息"
)
private
String
message
;
@FieldDescribe
(
"config文件内容"
)
private
String
fileContent
;
@FieldDescribe
(
"是否Sample"
)
private
boolean
isSample
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
@FieldDescribe
(
"执行消息"
)
private
String
message
;
public
String
getStatus
()
{
return
status
;
}
@FieldDescribe
(
"config文件内容"
)
private
String
fileContent
;
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
@FieldDescribe
(
"是否Sample"
)
private
boolean
isSample
;
public
String
getFileContent
()
{
return
fileContent
;
}
public
String
getTime
(
)
{
return
time
;
}
public
void
setFileContent
(
String
fileContent
)
{
this
.
fileContent
=
fileContent
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
tim
e
;
}
public
boolean
isSample
(
)
{
return
isSampl
e
;
}
public
String
getStatus
(
)
{
return
status
;
}
public
void
setSample
(
boolean
isSample
)
{
this
.
isSample
=
isSample
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getMessage
(
)
{
return
message
;
}
public
String
getFileContent
(
)
{
return
fileContent
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
void
setFileContent
(
String
fileContent
)
{
this
.
fileContent
=
fileContent
;
}
public
boolean
isSample
()
{
return
isSample
;
}
public
void
setSample
(
boolean
isSample
)
{
this
.
isSample
=
isSample
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ImAction.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumed.java
浏览文件 @
d1b120c7
...
...
@@ -6,6 +6,7 @@ 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.entity.JpaObject
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
...
...
@@ -18,15 +19,18 @@ import com.x.message.core.entity.Instant;
class
ActionCurrentPersonConsumed
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumed
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumed
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
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
(),
Instan
t
.
id_FIELDNAME
,
wi
.
getIdList
());
effectivePerson
.
getDistinguishedName
(),
JpaObjec
t
.
id_FIELDNAME
,
wi
.
getIdList
());
if
(!
os
.
isEmpty
())
{
emc
.
beginTransaction
(
Instant
.
class
);
for
(
Instant
o
:
os
)
{
...
...
@@ -44,8 +48,10 @@ class ActionCurrentPersonConsumed extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
8841713058732134969L
;
@FieldDescribe
(
"标识"
)
List
<
String
>
idList
=
new
ArrayList
<>();
private
List
<
String
>
idList
=
new
ArrayList
<>();
public
List
<
String
>
getIdList
()
{
return
idList
;
...
...
@@ -59,6 +65,8 @@ class ActionCurrentPersonConsumed extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
1495388301034226530L
;
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionCurrentPersonConsumedAll.java
浏览文件 @
d1b120c7
...
...
@@ -13,9 +13,12 @@ import com.x.message.core.entity.Instant;
class
ActionCurrentPersonConsumedAll
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumedAll
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCurrentPersonConsumedAll
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
List
<
Instant
>
os
=
emc
.
listEqual
(
Instant
.
class
,
Instant
.
person_FIELDNAME
,
...
...
@@ -36,6 +39,8 @@ class ActionCurrentPersonConsumedAll extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
1093854084336722449L
;
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListNext.java
浏览文件 @
d1b120c7
...
...
@@ -11,13 +11,20 @@ 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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
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
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListNext
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
count
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListPrev.java
浏览文件 @
d1b120c7
...
...
@@ -11,13 +11,20 @@ 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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
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
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListPrev
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
count
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonAsc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonAsc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedAsc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonConsumedAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedAsc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonConsumedDesc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonConsumedDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedDesc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonConsumedDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonDesc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonDesc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedAsc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonNotConsumedAsc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedAsc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedAsc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonNotConsumedDesc.java
浏览文件 @
d1b120c7
...
...
@@ -25,9 +25,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonNotConsumedDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedDesc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonNotConsumedDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/instant/ActionListWithCurrentPersonWithoutIMDesc.java
浏览文件 @
d1b120c7
...
...
@@ -26,9 +26,12 @@ import com.x.message.core.entity.Instant_;
class
ActionListWithCurrentPersonWithoutIMDesc
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonWithoutIMDesc
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithCurrentPersonWithoutIMDesc
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionCreate.java
浏览文件 @
d1b120c7
...
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.google.gson.JsonElement
;
...
...
@@ -34,10 +35,12 @@ import com.x.organization.core.entity.Person;
class
ActionCreate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCreate
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCreate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
logger
.
debug
(
"receive{}."
,
jsonElement
);
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
@@ -66,16 +69,17 @@ class ActionCreate extends BaseAction {
people
.
addAll
(
business
.
organization
().
person
().
listWithGroup
(
mass
.
getGroupList
()));
mass
.
setSendPersonList
(
ListTools
.
trim
(
people
,
true
,
true
));
List
<
List
<
String
>>
list
=
ListTools
.
batch
(
mass
.
getSendPersonList
(),
500
);
if
(
Config
.
qiyeweixin
().
getEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
Config
.
qiyeweixin
().
getEnable
()
))
{
this
.
qiyeweixin
(
business
,
mass
.
getBody
(),
list
);
mass
.
setType
(
Mass
.
TYPE_QIYEWEIXIN
);
}
else
if
(
Config
.
dingding
().
getEnable
(
))
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
dingding
().
getEnable
()
))
{
this
.
dingding
(
business
,
mass
.
getBody
(),
list
);
mass
.
setType
(
Mass
.
TYPE_DINGDING
);
}
else
if
(
Config
.
zhengwuDingding
().
getEnable
(
))
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
zhengwuDingding
().
getEnable
()
))
{
this
.
zhengwuDingding
(
business
,
mass
.
getBody
(),
list
);
mass
.
setType
(
Mass
.
TYPE_ZHENGWUDINGDING
);
}
else
if
(
Config
.
weLink
().
getEnable
()
&&
Config
.
weLink
().
getMessageEnable
())
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
weLink
().
getEnable
())
&&
BooleanUtils
.
isTrue
(
Config
.
weLink
().
getMessageEnable
()))
{
this
.
welink
(
business
,
mass
.
getBody
(),
list
);
mass
.
setType
(
Mass
.
TYPE_WELINK
);
}
...
...
@@ -154,11 +158,11 @@ class ActionCreate extends BaseAction {
m
.
setMsgTitle
(
"消息"
);
m
.
setMsgContent
(
body
);
Date
now
=
new
Date
();
m
.
setCreateTime
(
now
.
getTime
()
+
""
);
logger
.
info
(
"welink send body: "
+
m
.
toString
());
m
.
setCreateTime
(
now
.
getTime
()
+
""
);
LOGGER
.
info
(
"welink send body: "
+
m
.
toString
());
String
address
=
Config
.
weLink
().
getOapiAddress
()
+
"/messages/v3/send"
;
logger
.
info
(
"welink send url: "
+
address
);
LOGGER
.
info
(
"welink send url: "
+
address
);
List
<
NameValuePair
>
heads
=
new
ArrayList
<>();
heads
.
add
(
new
NameValuePair
(
WeLink
.
WeLink_Auth_Head_Key
,
Config
.
weLink
().
accessToken
()));
WeLinkMessageResp
resp
=
HttpConnection
.
postAsObject
(
address
,
heads
,
m
.
toString
(),
WeLinkMessageResp
.
class
);
...
...
@@ -167,10 +171,8 @@ class ActionCreate extends BaseAction {
}
}
}
public
static
class
WeLinkMessageResp
{
private
String
code
;
...
...
@@ -308,14 +310,6 @@ class ActionCreate extends BaseAction {
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
;
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionDelete.java
浏览文件 @
d1b120c7
...
...
@@ -8,12 +8,20 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Mass
;
class
ActionDelete
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDelete
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
@@ -36,6 +44,8 @@ class ActionDelete extends BaseAction {
}
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
2986717781083820722L
;
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionEnableType.java
浏览文件 @
d1b120c7
package
com.x.message.assemble.communicate.jaxrs.mass
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.Config
;
...
...
@@ -7,12 +9,20 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapString
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Mass
;
class
ActionEnableType
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionEnableType
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
@@ -23,13 +33,14 @@ class ActionEnableType extends BaseAction {
Wo
wo
=
new
Wo
();
if
(
Config
.
qiyeweixin
().
getEnable
(
))
{
if
(
BooleanUtils
.
isTrue
(
Config
.
qiyeweixin
().
getEnable
()
))
{
wo
.
setValue
(
Mass
.
TYPE_QIYEWEIXIN
);
}
else
if
(
Config
.
dingding
().
getEnable
(
))
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
dingding
().
getEnable
()
))
{
wo
.
setValue
(
Mass
.
TYPE_DINGDING
);
}
else
if
(
Config
.
zhengwuDingding
().
getEnable
(
))
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
zhengwuDingding
().
getEnable
()
))
{
wo
.
setValue
(
Mass
.
TYPE_ZHENGWUDINGDING
);
}
else
if
(
Config
.
weLink
().
getEnable
()
&&
Config
.
weLink
().
getMessageEnable
())
{
}
else
if
(
BooleanUtils
.
isTrue
(
Config
.
weLink
().
getEnable
())
&&
BooleanUtils
.
isTrue
(
Config
.
weLink
().
getMessageEnable
()))
{
wo
.
setValue
(
Mass
.
TYPE_WELINK
);
}
else
{
wo
.
setValue
(
""
);
...
...
@@ -41,6 +52,8 @@ class ActionEnableType extends BaseAction {
public
static
class
Wo
extends
WrapString
{
private
static
final
long
serialVersionUID
=
-
1681442801874856071L
;
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionGet.java
浏览文件 @
d1b120c7
...
...
@@ -9,12 +9,20 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
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.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Mass
;
class
ActionGet
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionGet
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionListNext.java
浏览文件 @
d1b120c7
...
...
@@ -11,12 +11,20 @@ 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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Mass
;
class
ActionListNext
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListNext
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
@@ -25,8 +33,8 @@ class ActionListNext extends BaseAction {
}
}
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
result
=
this
.
standardListNext
(
Wo
.
copier
,
id
,
count
,
JpaObject
.
sequence_FIELDNAME
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
true
,
DESC
);
result
=
this
.
standardListNext
(
Wo
.
copier
,
id
,
count
,
JpaObject
.
sequence_FIELDNAME
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
true
,
DESC
);
return
result
;
}
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/mass/ActionListPrev.java
浏览文件 @
d1b120c7
...
...
@@ -11,12 +11,20 @@ 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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.organization.OrganizationDefinition
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Mass
;
class
ActionListPrev
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListPrev
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, count:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
count
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
if
(
effectivePerson
.
isNotManager
()
&&
(!
business
.
organization
().
person
().
hasRole
(
effectivePerson
,
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionCustomCreate.java
浏览文件 @
d1b120c7
...
...
@@ -22,11 +22,14 @@ import com.x.message.assemble.communicate.ThisApplication;
class
ActionCustomCreate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCustomCreate
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCustomCreate
.
class
);
private
static
final
String
CUSTOM_PREFIX
=
"custom_"
;
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
...
...
@@ -45,6 +48,8 @@ class ActionCustomCreate extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
130960158845033826L
;
static
WrapCopier
<
Wi
,
MessageConnector
.
Wrap
>
copier
=
WrapCopierFactory
.
wi
(
Wi
.
class
,
MessageConnector
.
Wrap
.
class
,
null
,
JpaObject
.
FieldsUnmodify
);
...
...
@@ -96,6 +101,8 @@ class ActionCustomCreate extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
7102367852270900958L
;
}
}
\ No newline at end of file
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/message/ActionListPaging.java
浏览文件 @
d1b120c7
...
...
@@ -9,18 +9,22 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
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.entity.JpaObject
;
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.gson.GsonPropertyObject
;
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.tools.DateTools
;
import
com.x.message.assemble.communicate.Business
;
import
com.x.message.core.entity.Message
;
...
...
@@ -28,8 +32,13 @@ import com.x.message.core.entity.Message_;
class
ActionListPaging
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCustomCreate
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, page:{}, size:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
page
,
()
->
size
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
...
...
@@ -50,29 +59,31 @@ class ActionListPaging extends BaseAction {
Root
<
Message
>
root
=
cq
.
from
(
Message
.
class
);
Predicate
p
=
cb
.
conjunction
();
if
(
StringUtils
.
isNotEmpty
(
wi
.
getPerson
()))
{
if
(
StringUtils
.
isNotEmpty
(
wi
.
getPerson
()))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Message_
.
person
),
wi
.
getPerson
()));
}
if
(
StringUtils
.
isNotEmpty
(
wi
.
getType
()))
{
if
(
StringUtils
.
isNotEmpty
(
wi
.
getType
()))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Message_
.
type
),
wi
.
getType
()));
}
if
(
StringUtils
.
isNotEmpty
(
wi
.
getConsume
()))
{
if
(
StringUtils
.
isNotEmpty
(
wi
.
getConsume
()))
{
p
=
cb
.
and
(
p
,
cb
.
equal
(
root
.
get
(
Message_
.
consumer
),
wi
.
getConsume
()));
}
if
(
DateTools
.
isDateTimeOrDate
(
wi
.
getStartTime
(
)))
{
p
=
cb
.
and
(
p
,
cb
.
greaterThan
(
root
.
get
(
Message
_
.
createTime
),
DateTools
.
parse
(
wi
.
getStartTime
())));
if
(
BooleanUtils
.
isTrue
(
DateTools
.
isDateTimeOrDate
(
wi
.
getStartTime
()
)))
{
p
=
cb
.
and
(
p
,
cb
.
greaterThan
(
root
.
get
(
JpaObject
_
.
createTime
),
DateTools
.
parse
(
wi
.
getStartTime
())));
}
if
(
DateTools
.
isDateTimeOrDate
(
wi
.
getEndTime
(
)))
{
p
=
cb
.
and
(
p
,
cb
.
lessThan
(
root
.
get
(
Message
_
.
createTime
),
DateTools
.
parse
(
wi
.
getEndTime
())));
if
(
BooleanUtils
.
isTrue
(
DateTools
.
isDateTimeOrDate
(
wi
.
getEndTime
()
)))
{
p
=
cb
.
and
(
p
,
cb
.
lessThan
(
root
.
get
(
JpaObject
_
.
createTime
),
DateTools
.
parse
(
wi
.
getEndTime
())));
}
return
p
;
}
public
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
8335537395971819377L
;
@FieldDescribe
(
"用户"
)
private
String
person
;
...
...
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionConsumed.java
浏览文件 @
d1b120c7
...
...
@@ -18,9 +18,12 @@ import com.x.message.core.entity.Org;
public
class
ActionConsumed
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionConsumed
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionConsumed
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
...
...
@@ -43,8 +46,10 @@ public class ActionConsumed extends BaseAction {
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3369205088748865633L
;
@FieldDescribe
(
"标识"
)
List
<
String
>
idList
=
new
ArrayList
<>();
private
List
<
String
>
idList
=
new
ArrayList
<>();
public
List
<
String
>
getIdList
()
{
return
idList
;
...
...
@@ -58,5 +63,7 @@ public class ActionConsumed extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
8756482612373916930L
;
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionCreate.java
浏览文件 @
d1b120c7
...
...
@@ -11,42 +11,30 @@ 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.Org
;
public
class
ActionCreate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCreate
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCreate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
logger
.
debug
(
"receive{}."
,
jsonElement
);
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Org
org
=
this
.
convertToWrapIn
(
jsonElement
,
Org
.
class
);
//ProcessOpinion processOpinion = this.convertToWrapIn(jsonElement, ProcessOpinion.class);
//Org org = Wi.copier.copy(wi);
emc
.
beginTransaction
(
Org
.
class
);
emc
.
persist
(
org
,
CheckPersistType
.
all
);
emc
.
commit
();
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
Wo
.
copier
.
copy
(
org
);
result
.
setData
(
wo
);
return
result
;
}
}
public
static
class
Wi
extends
Org
{
private
static
final
long
serialVersionUID
=
-
7940036098463672571L
;
static
WrapCopier
<
Wi
,
Org
>
copier
=
WrapCopierFactory
.
wi
(
Wi
.
class
,
Org
.
class
,
null
,
JpaObject
.
FieldsUnmodify
);
...
...
@@ -54,8 +42,7 @@ public class ActionCreate extends BaseAction {
public
static
class
Wo
extends
Org
{
private
static
final
long
serialVersionUID
=
-
7777196608701722718L
;
static
WrapCopier
<
Org
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Org
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Org
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Org
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
}
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionDelete.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionGet.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListNext.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListPrev.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionListWithCriteria.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionUpdateConsumed.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/org/ActionUpdateReceiveSystem.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/ws/ActionCreate.java
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
o2server/x_query_service_processing/pom.xml
浏览文件 @
d1b120c7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录