Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Tms
Commits
122f107c
Commit
122f107c
authored
4 years ago
by
xiweicheng
Browse files
Options
Download
Email Patches
Plain Diff
文件定位消息
parent
b70ec1d9
master
blog-child
blog-file-readonly
chatdirect-user-task
file-fixed
luckysheet
v2.28.0
v2.28.0-beta.1
v2.27.0
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
src/main/java/com/lhjz/portal/controller/ChatChannelController.java
+29
-0
...ava/com/lhjz/portal/controller/ChatChannelController.java
src/main/java/com/lhjz/portal/model/UuidBody.java
+32
-0
src/main/java/com/lhjz/portal/model/UuidBody.java
src/main/java/com/lhjz/portal/repository/ChatChannelRepository.java
+2
-0
...ava/com/lhjz/portal/repository/ChatChannelRepository.java
src/main/java/com/lhjz/portal/repository/ChatDirectRepository.java
+2
-0
...java/com/lhjz/portal/repository/ChatDirectRepository.java
src/main/java/com/lhjz/portal/repository/ChatReplyRepository.java
+2
-0
.../java/com/lhjz/portal/repository/ChatReplyRepository.java
src/main/java/com/lhjz/portal/util/AuthUtil.java
+28
-2
src/main/java/com/lhjz/portal/util/AuthUtil.java
with
95 additions
and
2 deletions
+95
-2
src/main/java/com/lhjz/portal/controller/ChatChannelController.java
+
29
-
0
View file @
122f107c
...
...
@@ -68,6 +68,7 @@ import com.lhjz.portal.model.Mail;
import
com.lhjz.portal.model.Poll
;
import
com.lhjz.portal.model.RespBody
;
import
com.lhjz.portal.model.ToastrPayload
;
import
com.lhjz.portal.model.UuidBody
;
import
com.lhjz.portal.pojo.Enum.Action
;
import
com.lhjz.portal.pojo.Enum.ChatLabelType
;
import
com.lhjz.portal.pojo.Enum.ChatMsgType
;
...
...
@@ -1844,4 +1845,32 @@ public class ChatChannelController extends BaseController {
return
RespBody
.
succeed
(
id
);
}
@GetMapping
(
"get/by/uuid"
)
@ResponseBody
public
RespBody
getByUuid
(
@RequestParam
(
"uuid"
)
String
uuid
)
{
ChatChannel
chatChannel
=
chatChannelRepository
.
findTopByUuid
(
uuid
);
if
(
chatChannel
==
null
)
{
ChatReply
chatReply
=
chatReplyRepository
.
findTopByUuid
(
uuid
);
if
(
chatReply
==
null
)
{
ChatDirect
chatDirect
=
chatDirectRepository
.
findTopByUuid
(
uuid
);
if
(
AuthUtil
.
hasChannelAuth
(
chatDirect
))
{
return
RespBody
.
succeed
(
UuidBody
.
builder
().
type
(
"chatDirect"
).
chatDirect
(
chatDirect
).
build
());
}
}
else
if
(
AuthUtil
.
hasChannelAuth
(
chatReply
))
{
return
RespBody
.
succeed
(
UuidBody
.
builder
().
type
(
"chatReply"
).
chatReply
(
chatReply
)
.
chatChannel
(
chatReply
.
getChatChannel
()).
build
());
}
}
else
if
(
AuthUtil
.
hasChannelAuth
(
chatChannel
))
{
return
RespBody
.
succeed
(
UuidBody
.
builder
().
type
(
"chatChannel"
).
chatChannel
(
chatChannel
).
build
());
}
return
RespBody
.
failed
(
"您没有权限查看该消息内容!"
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/lhjz/portal/model/UuidBody.java
0 → 100644
+
32
-
0
View file @
122f107c
/**
* 版权所有 (TMS)
*/
package
com.lhjz.portal.model
;
import
com.lhjz.portal.entity.ChatChannel
;
import
com.lhjz.portal.entity.ChatDirect
;
import
com.lhjz.portal.entity.ChatReply
;
import
lombok.Builder
;
import
lombok.Data
;
/**
*
* @author xi
*
* @date 2016年5月20日 下午8:38:54
*
*/
@Data
@Builder
public
class
UuidBody
{
private
String
type
;
private
ChatChannel
chatChannel
;
private
ChatDirect
chatDirect
;
private
ChatReply
chatReply
;
}
This diff is collapsed.
Click to expand it.
src/main/java/com/lhjz/portal/repository/ChatChannelRepository.java
+
2
-
0
View file @
122f107c
...
...
@@ -96,4 +96,6 @@ public interface ChatChannelRepository extends JpaRepository<ChatChannel, Long>
ChatChannel
findTopByChannelAndNoticeAndStatusNotOrderByUpdateDateDesc
(
Channel
channel
,
Boolean
notice
,
Status
status
);
ChatChannel
findTopByUuid
(
String
uuid
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/lhjz/portal/repository/ChatDirectRepository.java
+
2
-
0
View file @
122f107c
...
...
@@ -87,4 +87,6 @@ public interface ChatDirectRepository extends JpaRepository<ChatDirect, Long> {
@Query
(
value
=
"SELECT * FROM chat_direct WHERE creator = ?1 AND (upper(content) LIKE upper(?2))"
,
nativeQuery
=
true
)
List
<
ChatDirect
>
queryByCreatorAndContentLike
(
String
creator
,
String
contentLike
);
ChatDirect
findTopByUuid
(
String
uuid
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/lhjz/portal/repository/ChatReplyRepository.java
+
2
-
0
View file @
122f107c
...
...
@@ -30,4 +30,6 @@ public interface ChatReplyRepository extends JpaRepository<ChatReply, Long> {
Page
<
ChatReply
>
findByChatChannelAndTypeAndStatusNot
(
ChatChannel
chatChannel
,
ChatReplyType
type
,
Status
status
,
Pageable
pageable
);
ChatReply
findTopByUuid
(
String
uuid
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/lhjz/portal/util/AuthUtil.java
+
28
-
2
View file @
122f107c
...
...
@@ -5,6 +5,8 @@ import java.util.Set;
import
com.lhjz.portal.constant.SysConstant
;
import
com.lhjz.portal.entity.Channel
;
import
com.lhjz.portal.entity.ChatChannel
;
import
com.lhjz.portal.entity.ChatDirect
;
import
com.lhjz.portal.entity.ChatReply
;
import
com.lhjz.portal.entity.Space
;
import
com.lhjz.portal.entity.SpaceAuthority
;
import
com.lhjz.portal.entity.security.User
;
...
...
@@ -31,6 +33,15 @@ public class AuthUtil {
return
isSuperOrCreator
(
creator
.
getUsername
());
}
public
static
boolean
hasChannelAuth
(
ChatReply
cr
)
{
if
(
cr
==
null
)
{
return
false
;
}
return
hasChannelAuth
(
cr
.
getChatChannel
());
}
public
static
boolean
hasChannelAuth
(
ChatChannel
cc
)
{
if
(
cc
==
null
)
{
...
...
@@ -57,7 +68,7 @@ public class AuthUtil {
User
loginUser
=
new
User
(
WebUtil
.
getUsername
());
return
c
.
getMembers
().
contains
(
loginUser
);
}
public
static
boolean
isChannelMember
(
Channel
c
)
{
if
(
c
==
null
)
{
...
...
@@ -67,7 +78,7 @@ public class AuthUtil {
User
loginUser
=
new
User
(
WebUtil
.
getUsername
());
return
c
.
getMembers
().
contains
(
loginUser
);
}
public
static
boolean
hasSpaceAuth
(
Space
s
)
{
if
(
s
==
null
)
{
...
...
@@ -117,4 +128,19 @@ public class AuthUtil {
return
exists
;
}
public
static
boolean
hasChannelAuth
(
ChatDirect
chatDirect
)
{
if
(
chatDirect
==
null
)
{
return
false
;
}
if
(
isSuperOrCreator
(
chatDirect
.
getCreator
().
getUsername
()))
{
return
true
;
}
User
loginUser
=
new
User
(
WebUtil
.
getUsername
());
return
chatDirect
.
getChatTo
().
equals
(
loginUser
);
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help