Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
cms
Commits
3eb3b264
提交
3eb3b264
authored
1月 29, 2024
作者:
han
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用户聊天功能相关接口
上级
1c0439ea
流水线
#8140
已通过 于阶段
in 2 分 8 秒
变更
14
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
516 行增加
和
14 行删除
+516
-14
MessageUserQO.java
...c/main/java/com/mmc/iuav/user/model/qo/MessageUserQO.java
+38
-0
UserMessageVO.java
...c/main/java/com/mmc/iuav/user/model/vo/UserMessageVO.java
+26
-0
MessageController.java
.../java/com/mmc/iuav/user/controller/MessageController.java
+36
-1
PilotCertificationController.java
...r/controller/dronepilot/PilotCertificationController.java
+4
-4
MessageDao.java
...-user/src/main/java/com/mmc/iuav/user/dao/MessageDao.java
+31
-0
UserAccountDO.java
...src/main/java/com/mmc/iuav/user/entity/UserAccountDO.java
+4
-0
UserDO.java
...e-user/src/main/java/com/mmc/iuav/user/entity/UserDO.java
+39
-0
UserMessageDO.java
...src/main/java/com/mmc/iuav/user/entity/UserMessageDO.java
+57
-0
UserMessageLogDO.java
.../main/java/com/mmc/iuav/user/entity/UserMessageLogDO.java
+47
-0
MessageService.java
...c/main/java/com/mmc/iuav/user/service/MessageService.java
+17
-3
PilotCertificationService.java
...av/user/service/dronepilot/PilotCertificationService.java
+1
-1
PilotCertificationServiceImpl.java
...ervice/dronepilot/impl/PilotCertificationServiceImpl.java
+5
-2
MessageServiceImpl.java
...va/com/mmc/iuav/user/service/impl/MessageServiceImpl.java
+112
-3
MessageDao.xml
...cms-service-user/src/main/resources/mapper/MessageDao.xml
+99
-0
没有找到文件。
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/qo/MessageUserQO.java
0 → 100644
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
model
.
qo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.domain.Page
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @Author han
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
MessageUserQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"页码"
,
required
=
true
,
example
=
"1"
)
@NotNull
(
message
=
"页码不能为空"
,
groups
=
Page
.
class
)
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageNo
;
@ApiModelProperty
(
value
=
"每页显示数"
,
required
=
true
,
example
=
"10"
)
@NotNull
(
message
=
"每页显示数不能为空"
,
groups
=
Page
.
class
)
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageSize
;
@ApiModelProperty
(
value
=
"接收方用户ID"
)
private
Integer
receiverUserId
;
public
void
buildCurrentPage
()
{
this
.
pageNo
=
(
pageNo
-
1
)
*
pageSize
;
}
}
cms-common/cms-common-model/src/main/java/com/mmc/iuav/user/model/vo/UserMessageVO.java
0 → 100644
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
model
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @author han
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UserMessageVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973044768156590099L
;
@ApiModelProperty
(
value
=
"接收方用户ID"
)
private
Integer
receiverUserId
;
@ApiModelProperty
(
value
=
"消息内容"
)
private
String
content
;
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/MessageController.java
浏览文件 @
3eb3b264
...
@@ -2,10 +2,11 @@ package com.mmc.iuav.user.controller;
...
@@ -2,10 +2,11 @@ package com.mmc.iuav.user.controller;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageUserQO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.UserMessageVO
;
import
com.mmc.iuav.user.service.MessageService
;
import
com.mmc.iuav.user.service.MessageService
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.*
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -67,4 +68,38 @@ public class MessageController extends BaseController{
...
@@ -67,4 +68,38 @@ public class MessageController extends BaseController{
Integer
userId
=
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
();
Integer
userId
=
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
();
return
messageService
.
removeMessageByUser
(
userId
,
messageId
);
return
messageService
.
removeMessageByUser
(
userId
,
messageId
);
}
}
@ApiOperation
(
value
=
"用户发送消息"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/insertUserMessage"
)
public
ResultBody
insertUserMessage
(
HttpServletRequest
request
,
@RequestBody
UserMessageVO
messageVO
){
return
messageService
.
insertUserMessage
(
messageVO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"用户聊天详细信息"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/selectUserMessage"
)
public
ResultBody
selectUserMessage
(
HttpServletRequest
request
,
@RequestBody
MessageUserQO
messageQO
){
return
ResultBody
.
success
(
messageService
.
selectUserMessage
(
messageQO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
()));
}
@ApiOperation
(
value
=
"用户列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/selectUserList"
)
public
ResultBody
selectUserList
(
HttpServletRequest
request
){
return
messageService
.
selectUserList
(
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"用户列表——用户移除"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/removeUser"
)
public
ResultBody
removeUser
(
HttpServletRequest
request
,
@ApiParam
(
value
=
"接收人ID"
)
@RequestParam
Integer
receiverUserId
){
return
messageService
.
removeUser
(
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
receiverUserId
);
}
@ApiOperation
(
value
=
"用户撤回消息(三分钟之内可以撤回)"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/removeUserMessage"
)
public
ResultBody
removeUserMessage
(
@ApiParam
(
value
=
"消息ID"
)
@RequestParam
Integer
id
){
return
messageService
.
removeUserMessage
(
id
);
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/dronepilot/PilotCertificationController.java
浏览文件 @
3eb3b264
...
@@ -74,8 +74,8 @@ public class PilotCertificationController extends BaseController {
...
@@ -74,8 +74,8 @@ public class PilotCertificationController extends BaseController {
@ApiOperation
(
value
=
"小程序——详情————飞手执照及能力认证"
)
@ApiOperation
(
value
=
"小程序——详情————飞手执照及能力认证"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PilotCertificationDTO
.
class
)})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PilotCertificationDTO
.
class
)})
@GetMapping
(
"/detailPilot"
)
@GetMapping
(
"/detailPilot"
)
public
ResultBody
<
PilotCertificationDTO
>
detailPilot
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"id"
,
required
=
true
)
Integer
id
)
{
public
ResultBody
detailPilot
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"id"
,
required
=
true
)
Integer
id
)
{
return
ResultBody
.
success
(
certificationService
.
detailPilot
(
id
)
);
return
certificationService
.
detailPilot
(
id
);
}
}
@ApiOperation
(
value
=
"小程序——用户详情————飞手执照及能力认证"
)
@ApiOperation
(
value
=
"小程序——用户详情————飞手执照及能力认证"
)
...
@@ -114,8 +114,8 @@ public class PilotCertificationController extends BaseController {
...
@@ -114,8 +114,8 @@ public class PilotCertificationController extends BaseController {
@ApiOperation
(
value
=
"后台管理——详情————飞手执照及能力认证"
)
@ApiOperation
(
value
=
"后台管理——详情————飞手执照及能力认证"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PilotCertificationDTO
.
class
)})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PilotCertificationDTO
.
class
)})
@GetMapping
(
"/backDetailPilot"
)
@GetMapping
(
"/backDetailPilot"
)
public
ResultBody
<
PilotCertificationDTO
>
backDetailPilot
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"id"
,
required
=
true
)
Integer
id
)
{
public
ResultBody
backDetailPilot
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"id"
,
required
=
true
)
Integer
id
)
{
return
ResultBody
.
success
(
certificationService
.
detailPilot
(
id
)
);
return
certificationService
.
detailPilot
(
id
);
}
}
@ApiOperation
(
value
=
"后台管理——修改备注————飞手执照及能力认证"
)
@ApiOperation
(
value
=
"后台管理——修改备注————飞手执照及能力认证"
)
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/dao/MessageDao.java
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
dao
;
package
com
.
mmc
.
iuav
.
user
.
dao
;
import
com.mmc.iuav.user.entity.SystemMessageDO
;
import
com.mmc.iuav.user.entity.SystemMessageDO
;
import
com.mmc.iuav.user.entity.UserMessageDO
;
import
com.mmc.iuav.user.entity.UserMessageLogDO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageUserQO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -81,4 +84,32 @@ public interface MessageDao {
...
@@ -81,4 +84,32 @@ public interface MessageDao {
* @return
* @return
*/
*/
int
selectReceiverMessageByDel
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"messageId"
)
Integer
messageId
);
int
selectReceiverMessageByDel
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"messageId"
)
Integer
messageId
);
/**
* 添加用户消息
* @param messageDO
* @return
*/
int
insertUserMessage
(
UserMessageDO
messageDO
);
List
<
UserMessageDO
>
selectUserMessage
(
@Param
(
"messageQO"
)
MessageUserQO
messageQO
,
@Param
(
"senderUserId"
)
Integer
senderUserId
);
int
countUserMessage
(
@Param
(
"receiverUserId"
)
Integer
receiverUserId
,
@Param
(
"senderUserId"
)
Integer
senderUserId
);
List
<
Integer
>
selectUserListBySenderUserId
(
@Param
(
"senderUserId"
)
Integer
senderUserId
);
List
<
Integer
>
selectUserListByReceiverUserId
(
@Param
(
"senderUserId"
)
Integer
senderUserId
);
int
removeUserMessage
(
Integer
id
);
int
insertUserMessageLog
(
UserMessageLogDO
userMessageLogDO
);
Integer
isUserMessageLog
(
@Param
(
"receiverUserId"
)
Integer
receiverUserId
,
@Param
(
"senderUserId"
)
Integer
senderUserId
);
int
updateUserMessageLog
(
@Param
(
"id"
)
Integer
logId
);
int
updateUserMessageCount
(
@Param
(
"id"
)
Integer
logId
);
int
removeUserMessageCount
(
@Param
(
"id"
)
Integer
logId
);
List
<
UserMessageLogDO
>
selectUserList
(
@Param
(
"senderUserId"
)
Integer
senderUserId
);
void
removeUserMessageLog
(
@Param
(
"id"
)
Integer
logId
);
UserMessageDO
selectUserMessageById
(
@Param
(
"id"
)
Integer
id
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/UserAccountDO.java
浏览文件 @
3eb3b264
...
@@ -156,4 +156,8 @@ public class UserAccountDO implements Serializable {
...
@@ -156,4 +156,8 @@ public class UserAccountDO implements Serializable {
return
TopInviteVO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
id
+
""
).
nickName
(
this
.
nickName
).
userName
(
this
.
userName
).
phoneNum
(
this
.
phoneNum
)
return
TopInviteVO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
id
+
""
).
nickName
(
this
.
nickName
).
userName
(
this
.
userName
).
phoneNum
(
this
.
phoneNum
)
.
inviteCount
(
this
.
inviteCount
).
userImg
(
this
.
userImg
).
build
();
.
inviteCount
(
this
.
inviteCount
).
userImg
(
this
.
userImg
).
build
();
}
}
public
UserDO
buildUserDO
()
{
return
UserDO
.
builder
().
userAccountId
(
this
.
id
).
nickName
(
this
.
nickName
).
userName
(
this
.
userName
).
userImg
(
this
.
userImg
).
build
();
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/UserDO.java
0 → 100644
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
entity
;
import
com.mmc.iuav.user.model.dto.UserAccountSimpleDTO
;
import
com.mmc.iuav.user.model.vo.BUserAccountVO
;
import
com.mmc.iuav.user.model.vo.TopInviteVO
;
import
com.mmc.iuav.user.model.vo.UserAccountVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.util.CollectionUtils
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author: zj
* @Date: 2023/5/16 17:00
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
UserDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5007589179946146721L
;
@ApiModelProperty
(
value
=
"用户ID"
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"用户姓名"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"用户昵称"
)
private
String
nickName
;
@ApiModelProperty
(
value
=
"头像"
)
private
String
userImg
;
@ApiModelProperty
(
value
=
"未读的消息个数"
)
private
Integer
unreadCount
;
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/UserMessageDO.java
0 → 100644
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
entity
;
import
com.alibaba.fastjson2.annotation.JSONField
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.UserMessageVO
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author han
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UserMessageDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973044768156590099L
;
/**
* 消息ID
*/
private
Integer
id
;
/**
* 发送方
*/
private
Integer
senderUserId
;
/**
* 接收方
*/
private
Integer
receiverUserId
;
/**
* 消息内容
*/
private
String
content
;
/**
* 消息图片
*/
private
String
imgUrl
;
/**
* 创建时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
public
UserMessageDO
(
UserMessageVO
message
)
{
this
.
receiverUserId
=
message
.
getReceiverUserId
();
this
.
content
=
message
.
getContent
();
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/UserMessageLogDO.java
0 → 100644
浏览文件 @
3eb3b264
package
com
.
mmc
.
iuav
.
user
.
entity
;
import
com.alibaba.fastjson2.annotation.JSONField
;
import
com.mmc.iuav.user.model.vo.UserMessageVO
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author han
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UserMessageLogDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
973044768156590099L
;
/**
* 消息记录ID
*/
private
Integer
id
;
/**
* 发送方
*/
private
Integer
senderUserId
;
/**
* 接收方
*/
private
Integer
receiverUserId
;
/**
* 新消息数量
*/
private
Integer
messageCount
;
/**
* 创建时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
newTime
;
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/MessageService.java
浏览文件 @
3eb3b264
...
@@ -2,11 +2,10 @@ package com.mmc.iuav.user.service;
...
@@ -2,11 +2,10 @@ package com.mmc.iuav.user.service;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.entity.SystemMessageDO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageUserQO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.UserMessageVO
;
import
java.util.List
;
public
interface
MessageService
{
public
interface
MessageService
{
/**
/**
...
@@ -56,4 +55,19 @@ public interface MessageService {
...
@@ -56,4 +55,19 @@ public interface MessageService {
* @return
* @return
*/
*/
ResultBody
removeMessageByUser
(
Integer
userId
,
Integer
messageId
);
ResultBody
removeMessageByUser
(
Integer
userId
,
Integer
messageId
);
/**
* 添加用户消息
* @param messageVO
* @return
*/
ResultBody
insertUserMessage
(
UserMessageVO
messageVO
,
Integer
senderUserId
);
PageResult
selectUserMessage
(
MessageUserQO
messageQO
,
Integer
senderUserId
);
ResultBody
selectUserList
(
Integer
senderUserId
);
ResultBody
removeUserMessage
(
Integer
id
);
ResultBody
removeUser
(
Integer
senderUserId
,
Integer
receiverUserId
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/dronepilot/PilotCertificationService.java
浏览文件 @
3eb3b264
...
@@ -29,7 +29,7 @@ public interface PilotCertificationService {
...
@@ -29,7 +29,7 @@ public interface PilotCertificationService {
PageResult
pilotList
(
PilotCertificationQO
param
);
PageResult
pilotList
(
PilotCertificationQO
param
);
PilotCertificationDTO
detailPilot
(
Integer
id
);
ResultBody
detailPilot
(
Integer
id
);
PilotCertificationDTO
userDetailPilot
(
Integer
userAccountId
);
PilotCertificationDTO
userDetailPilot
(
Integer
userAccountId
);
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/dronepilot/impl/PilotCertificationServiceImpl.java
浏览文件 @
3eb3b264
...
@@ -217,8 +217,11 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
...
@@ -217,8 +217,11 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
@Override
@Override
public
PilotCertificationDTO
detailPilot
(
Integer
id
)
{
public
ResultBody
detailPilot
(
Integer
id
)
{
PilotCertificationDO
certificationDO
=
certificationDao
.
detailPilot
(
id
);
PilotCertificationDO
certificationDO
=
certificationDao
.
detailPilot
(
id
);
if
(
certificationDO
.
getBirthday
()
==
null
){
return
ResultBody
.
error
(
"请先进行实名认证"
);
}
int
yearsOfWorking
=
0
;
int
yearsOfWorking
=
0
;
yearsOfWorking
=
getYearsOfWorking
(
certificationDO
.
getTimeOfApplication
());
yearsOfWorking
=
getYearsOfWorking
(
certificationDO
.
getTimeOfApplication
());
Integer
Working
=
certificationDO
.
getYearsOfWorking
();
Integer
Working
=
certificationDO
.
getYearsOfWorking
();
...
@@ -235,7 +238,7 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
...
@@ -235,7 +238,7 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
pilotCertificationDTO
.
setBackUserId
(
flyingTeam
.
getBackUserId
());
pilotCertificationDTO
.
setBackUserId
(
flyingTeam
.
getBackUserId
());
pilotCertificationDTO
.
setMessageId
(
flyingTeam
.
getMessageId
());
pilotCertificationDTO
.
setMessageId
(
flyingTeam
.
getMessageId
());
}
}
return
pilotCertificationDTO
;
return
ResultBody
.
success
(
pilotCertificationDTO
)
;
}
}
@Override
@Override
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/impl/MessageServiceImpl.java
浏览文件 @
3eb3b264
...
@@ -3,21 +3,30 @@ package com.mmc.iuav.user.service.impl;
...
@@ -3,21 +3,30 @@ package com.mmc.iuav.user.service.impl;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.user.dao.MessageDao
;
import
com.mmc.iuav.user.dao.MessageDao
;
import
com.mmc.iuav.user.entity.SystemMessageDO
;
import
com.mmc.iuav.user.dao.UserServiceDao
;
import
com.mmc.iuav.user.entity.*
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageQO
;
import
com.mmc.iuav.user.model.qo.MessageUserQO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.SystemMessageVO
;
import
com.mmc.iuav.user.model.vo.UserMessageVO
;
import
com.mmc.iuav.user.service.MessageService
;
import
com.mmc.iuav.user.service.MessageService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.text.SimpleDateFormat
;
import
java.util.List
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
@Service
@Service
public
class
MessageServiceImpl
implements
MessageService
{
public
class
MessageServiceImpl
implements
MessageService
{
@Autowired
@Autowired
private
MessageDao
messageDao
;
private
MessageDao
messageDao
;
@Autowired
private
UserServiceDao
userServiceDao
;
@Override
@Override
public
ResultBody
insertSystemMessage
(
SystemMessageVO
messageVO
)
{
public
ResultBody
insertSystemMessage
(
SystemMessageVO
messageVO
)
{
SystemMessageDO
systemMessageDO
=
new
SystemMessageDO
(
messageVO
);
SystemMessageDO
systemMessageDO
=
new
SystemMessageDO
(
messageVO
);
...
@@ -107,4 +116,104 @@ public class MessageServiceImpl implements MessageService {
...
@@ -107,4 +116,104 @@ public class MessageServiceImpl implements MessageService {
return
ResultBody
.
error
(
"删除失败"
);
return
ResultBody
.
error
(
"删除失败"
);
}
}
@Override
public
ResultBody
insertUserMessage
(
UserMessageVO
messageVO
,
Integer
senderUserId
)
{
UserMessageDO
userMessageDO
=
new
UserMessageDO
(
messageVO
);
if
(
senderUserId
==
null
){
return
ResultBody
.
success
(
"消息发送失败,请先登录"
);
}
userMessageDO
.
setSenderUserId
(
senderUserId
);
if
(
messageDao
.
insertUserMessage
(
userMessageDO
)
!=
0
){
if
(
messageDao
.
isUserMessageLog
(
userMessageDO
.
getReceiverUserId
(),
userMessageDO
.
getSenderUserId
())
==
null
){
UserMessageLogDO
userMessageLogDO
=
new
UserMessageLogDO
();
userMessageLogDO
.
setSenderUserId
(
userMessageDO
.
getSenderUserId
());
userMessageLogDO
.
setReceiverUserId
(
userMessageDO
.
getReceiverUserId
());
messageDao
.
insertUserMessageLog
(
userMessageLogDO
);
}
Integer
logId
=
messageDao
.
isUserMessageLog
(
userMessageDO
.
getSenderUserId
(),
userMessageDO
.
getReceiverUserId
());
if
(
logId
==
null
){
UserMessageLogDO
userMessageLogDO
=
new
UserMessageLogDO
();
userMessageLogDO
.
setSenderUserId
(
userMessageDO
.
getReceiverUserId
());
userMessageLogDO
.
setReceiverUserId
(
userMessageDO
.
getSenderUserId
());
userMessageLogDO
.
setMessageCount
(
1
);
messageDao
.
insertUserMessageLog
(
userMessageLogDO
);
}
else
{
messageDao
.
updateUserMessageLog
(
logId
);
}
return
ResultBody
.
success
(
"消息发送成功"
);
}
return
ResultBody
.
error
(
"消息发送失败"
);
}
@Override
public
PageResult
selectUserMessage
(
MessageUserQO
messageQO
,
Integer
senderUserId
)
{
int
count
=
messageDao
.
countUserMessage
(
messageQO
.
getReceiverUserId
(),
senderUserId
);
if
(
count
==
0
)
{
return
PageResult
.
buildPage
(
messageQO
.
getPageNo
(),
messageQO
.
getPageSize
(),
count
);
}
Integer
pageNo
=
messageQO
.
getPageNo
();
messageQO
.
buildCurrentPage
();
List
<
UserMessageDO
>
messageList
=
messageDao
.
selectUserMessage
(
messageQO
,
senderUserId
);
// Integer logId = messageDao.isUserMessageLog(senderUserId,messageQO.getReceiverUserId());
// if(logId != null){
// messageDao.updateUserMessageCount(logId);
// }
Integer
logId2
=
messageDao
.
isUserMessageLog
(
messageQO
.
getReceiverUserId
(),
senderUserId
);
if
(
logId2
!=
null
){
messageDao
.
updateUserMessageCount
(
logId2
);
}
return
PageResult
.
buildPage
(
pageNo
,
messageQO
.
getPageSize
(),
count
,
messageList
);
}
@Override
public
ResultBody
selectUserList
(
Integer
senderUserId
)
{
List
<
UserDO
>
userAccountDOList
=
new
ArrayList
<>();
List
<
UserMessageLogDO
>
list
=
messageDao
.
selectUserList
(
senderUserId
);
for
(
UserMessageLogDO
userMessageLogDO
:
list
)
{
UserAccountDO
userAccount
=
userServiceDao
.
getUserAccountById
(
userMessageLogDO
.
getReceiverUserId
());
UserDO
userDO
=
userAccount
.
buildUserDO
();
userDO
.
setUnreadCount
(
userMessageLogDO
.
getMessageCount
());
userAccountDOList
.
add
(
userDO
);
}
return
ResultBody
.
success
(
userAccountDOList
);
}
@Override
public
ResultBody
removeUserMessage
(
Integer
id
)
{
UserMessageDO
userMessageDO
=
messageDao
.
selectUserMessageById
(
id
);
Date
createTime
=
userMessageDO
.
getCreateTime
();
String
time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
createTime
);
if
(
isOverThreeMinutes
(
time
)){
return
ResultBody
.
error
(
"消息发送已经超过三分钟,撤回失败"
);
}
if
(
messageDao
.
removeUserMessage
(
id
)
!=
0
){
Integer
logId
=
messageDao
.
isUserMessageLog
(
userMessageDO
.
getSenderUserId
(),
userMessageDO
.
getReceiverUserId
());
if
(
logId
!=
null
){
messageDao
.
removeUserMessageCount
(
logId
);
}
return
ResultBody
.
success
(
"消息撤回成功已撤回"
);
}
return
ResultBody
.
error
(
"消息撤回失败"
);
}
@Override
public
ResultBody
removeUser
(
Integer
senderUserId
,
Integer
receiverUserId
)
{
Integer
logId
=
messageDao
.
isUserMessageLog
(
receiverUserId
,
senderUserId
);
if
(
logId
!=
null
){
messageDao
.
removeUserMessageLog
(
logId
);
return
ResultBody
.
success
(
"删除成功"
);
}
return
ResultBody
.
error
(
"删除失败"
);
}
public
static
boolean
isOverThreeMinutes
(
String
createTime
)
{
// 定义日期时间格式化对象
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
// 将字符串格式的时间转换为 LocalDateTime 对象
LocalDateTime
createDateTime
=
LocalDateTime
.
parse
(
createTime
,
formatter
);
// 计算当前时间与创建时间的时间差(单位:秒)
long
secondsDiff
=
ChronoUnit
.
SECONDS
.
between
(
createDateTime
,
LocalDateTime
.
now
());
// 如果时间差大于 180 秒(即三分钟),返回 true
return
secondsDiff
>
180
;
}
}
}
csm-service/cms-service-user/src/main/resources/mapper/MessageDao.xml
浏览文件 @
3eb3b264
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.iuav.user.dao.MessageDao"
>
<mapper
namespace=
"com.mmc.iuav.user.dao.MessageDao"
>
<delete
id=
"removeUserMessageLog"
>
delete from user_message_log
where id = #{id}
</delete>
<select
id=
"selectSystemMessageById"
resultType=
"com.mmc.iuav.user.entity.SystemMessageDO"
>
<select
id=
"selectSystemMessageById"
resultType=
"com.mmc.iuav.user.entity.SystemMessageDO"
>
select
select
...
@@ -35,6 +40,48 @@
...
@@ -35,6 +40,48 @@
FROM message
FROM message
where is_deleted = 0
where is_deleted = 0
</select>
</select>
<select
id=
"selectUserMessage"
resultType=
"com.mmc.iuav.user.entity.UserMessageDO"
>
select
id, img_url, content, sender_user_id,receiver_user_id, create_time
from user_message
where is_deleted = 0 and sender_user_id in(#{senderUserId} ,#{messageQO.receiverUserId})
order by create_time desc
LIMIT #{messageQO.pageNo},#{messageQO.pageSize}
</select>
<select
id=
"countUserMessage"
resultType=
"java.lang.Integer"
>
select count(*)
from user_message
where is_deleted = 0 and sender_user_id in(#{senderUserId} ,#{receiverUserId})
</select>
<select
id=
"selectUserListBySenderUserId"
resultType=
"java.lang.Integer"
>
select
distinct receiver_user_id
from user_message
where is_deleted = 0 and sender_user_id = #{senderUserId}
</select>
<select
id=
"selectUserListByReceiverUserId"
resultType=
"java.lang.Integer"
>
select
distinct sender_user_id
from user_message
where is_deleted = 0 and receiver_user_id = #{senderUserId}
</select>
<select
id=
"isUserMessageLog"
resultType=
"java.lang.Integer"
>
select id
from user_message_log
where sender_user_id = #{senderUserId} and receiver_user_id = #{receiverUserId} limit 1
</select>
<select
id=
"selectUserList"
resultType=
"com.mmc.iuav.user.entity.UserMessageLogDO"
>
select *
from user_message_log
where sender_user_id = #{senderUserId}
</select>
<select
id=
"selectUserMessageById"
resultType=
"com.mmc.iuav.user.entity.UserMessageDO"
>
select
id, img_url, content, sender_user_id,receiver_user_id, create_time
from user_message
where is_deleted = 0 and id = #{id}
</select>
<insert
id=
"insertSystemMessage"
>
<insert
id=
"insertSystemMessage"
>
insert into message
insert into message
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
@@ -57,6 +104,34 @@
...
@@ -57,6 +104,34 @@
<if
test=
"messageId != null"
>
#{messageId},
</if>
<if
test=
"messageId != null"
>
#{messageId},
</if>
</trim>
</trim>
</insert>
</insert>
<insert
id=
"insertUserMessage"
>
insert into user_message
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"senderUserId != null"
>
sender_user_id,
</if>
<if
test=
"receiverUserId != null"
>
receiver_user_id,
</if>
<if
test=
"content != null"
>
content,
</if>
<if
test=
"imgUrl != null"
>
img_url,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"senderUserId != null"
>
#{senderUserId,jdbcType=VARCHAR},
</if>
<if
test=
"receiverUserId != null"
>
#{receiverUserId,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=VARCHAR},
</if>
<if
test=
"imgUrl != null"
>
#{imgUrl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert
id=
"insertUserMessageLog"
>
insert into user_message_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"senderUserId != null"
>
sender_user_id,
</if>
<if
test=
"receiverUserId != null"
>
receiver_user_id,
</if>
<if
test=
"messageCount != null"
>
message_count,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"senderUserId != null"
>
#{senderUserId,jdbcType=VARCHAR},
</if>
<if
test=
"receiverUserId != null"
>
#{receiverUserId,jdbcType=VARCHAR},
</if>
<if
test=
"messageCount != null"
>
#{messageCount,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update
id=
"removeMessage"
>
<update
id=
"removeMessage"
>
update message
update message
set is_deleted = 1, deleted_time = NOW()
set is_deleted = 1, deleted_time = NOW()
...
@@ -82,5 +157,29 @@
...
@@ -82,5 +157,29 @@
id = #{id}
id = #{id}
</where>
</where>
</update>
</update>
<update
id=
"removeUserMessage"
>
update user_message
set is_deleted = 1, deleted_time = NOW()
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateUserMessageLog"
>
update user_message_log
set
message_count = message_count + 1,
new_time = NOW()
where id = #{id}
</update>
<update
id=
"updateUserMessageCount"
>
update user_message_log
set
message_count = 0
where id = #{id}
</update>
<update
id=
"removeUserMessageCount"
>
update user_message_log
set
message_count = message_count - 1
where id = #{id}
</update>
</mapper>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论