Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
ims
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
ims
Commits
bc268fdc
提交
bc268fdc
authored
2月 26, 2024
作者:
刘明祎-运维用途
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop'
上级
ac23db7e
18b64239
流水线
#8300
已通过 于阶段
in 2 分 57 秒
变更
9
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
169 行增加
和
21 行删除
+169
-21
UpdateDynamicDO.java
...in/java/com/mmc/csf/release/forum/vo/UpdateDynamicDO.java
+24
-0
RedisConstant.java
...ain/java/com/mmc/csf/common/util/redis/RedisConstant.java
+1
-0
kustomization.yaml
kustomization/overlays/dev/kustomization.yaml
+1
-1
DynamicController.java
...ava/com/mmc/csf/release/controller/DynamicController.java
+24
-4
DynamicDao.java
...ice/src/main/java/com/mmc/csf/release/dao/DynamicDao.java
+5
-2
ForumDynamicDO.java
...java/com/mmc/csf/release/entity/forum/ForumDynamicDO.java
+2
-0
DynamicService.java
...main/java/com/mmc/csf/release/service/DynamicService.java
+16
-2
DynamicServiceImpl.java
.../com/mmc/csf/release/service/impl/DynamicServiceImpl.java
+64
-4
DynamicMapper.xml
...service/src/main/resources/mapper/forum/DynamicMapper.xml
+32
-8
没有找到文件。
csf-common/csf-common-model/src/main/java/com/mmc/csf/release/forum/vo/UpdateDynamicDO.java
0 → 100644
浏览文件 @
bc268fdc
package
com
.
mmc
.
csf
.
release
.
forum
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UpdateDynamicDO
implements
Serializable
{
@ApiModelProperty
(
value
=
"动态id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"动态描述"
)
private
String
description
;
@ApiModelProperty
(
value
=
"媒体资源"
)
private
List
<
MediaVO
>
mediaVO
;
}
csf-common/csf-common-util/src/main/java/com/mmc/csf/common/util/redis/RedisConstant.java
浏览文件 @
bc268fdc
...
@@ -109,6 +109,7 @@ public class RedisConstant {
...
@@ -109,6 +109,7 @@ public class RedisConstant {
public
final
static
String
UAV_DUMMY_DATA
=
"UAV_DUMMY_DATA_KEY"
;
public
final
static
String
UAV_DUMMY_DATA
=
"UAV_DUMMY_DATA_KEY"
;
public
final
static
String
VOTE
=
"VOTE"
;
/**
/**
* tagInfoAllot表的缓存key
* tagInfoAllot表的缓存key
*/
*/
...
...
kustomization/overlays/dev/kustomization.yaml
浏览文件 @
bc268fdc
...
@@ -18,4 +18,4 @@ patches:
...
@@ -18,4 +18,4 @@ patches:
images
:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/ims
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/ims
newTag
:
f3d4b90bc2e3aa1a3d671fc4f5d79f6f6182400b
newTag
:
77b23eebda554fc3bb58b646ffd8774af8280172
release-service/src/main/java/com/mmc/csf/release/controller/DynamicController.java
浏览文件 @
bc268fdc
...
@@ -8,6 +8,7 @@ import com.mmc.csf.release.entity.gambit.ForumAttentionDO;
...
@@ -8,6 +8,7 @@ import com.mmc.csf.release.entity.gambit.ForumAttentionDO;
import
com.mmc.csf.release.forum.vo.CommentVO
;
import
com.mmc.csf.release.forum.vo.CommentVO
;
import
com.mmc.csf.release.forum.vo.DynamicVO
;
import
com.mmc.csf.release.forum.vo.DynamicVO
;
import
com.mmc.csf.release.forum.vo.ReplyToAReviewVO
;
import
com.mmc.csf.release.forum.vo.ReplyToAReviewVO
;
import
com.mmc.csf.release.forum.vo.UpdateDynamicDO
;
import
com.mmc.csf.release.gambit.dto.ForumGambitDTO
;
import
com.mmc.csf.release.gambit.dto.ForumGambitDTO
;
import
com.mmc.csf.release.gambit.dto.PostingLeaderboardDTO
;
import
com.mmc.csf.release.gambit.dto.PostingLeaderboardDTO
;
import
com.mmc.csf.release.gambit.qo.ForumGambitQO
;
import
com.mmc.csf.release.gambit.qo.ForumGambitQO
;
...
@@ -43,6 +44,13 @@ public class DynamicController extends BaseController {
...
@@ -43,6 +44,13 @@ public class DynamicController extends BaseController {
return
dynamicService
.
insertDynamic
(
dynamicVO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
request
);
return
dynamicService
.
insertDynamic
(
dynamicVO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
request
);
}
}
@ApiOperation
(
value
=
"动态修改"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/updateDynamic"
)
public
ResultBody
updateDynamic
(
@RequestBody
UpdateDynamicDO
updateDynamicDO
,
HttpServletRequest
request
)
{
return
dynamicService
.
updateDynamic
(
updateDynamicDO
);
}
@ApiOperation
(
value
=
"点赞或取消点赞"
)
@ApiOperation
(
value
=
"点赞或取消点赞"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/likeOrCancel"
)
@GetMapping
(
"/likeOrCancel"
)
...
@@ -52,6 +60,13 @@ public class DynamicController extends BaseController {
...
@@ -52,6 +60,13 @@ public class DynamicController extends BaseController {
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
dynamicId
);
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
dynamicId
);
}
}
@ApiOperation
(
value
=
"查看剩余投票次数"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/getRemainingVotes"
)
public
ResultBody
getRemainingVotes
(
@ApiParam
(
value
=
"动态id"
)
@RequestParam
Integer
gambitId
,
HttpServletRequest
request
)
{
return
dynamicService
.
getRemainingVotes
(
gambitId
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"update-评论动态/回复"
)
@ApiOperation
(
value
=
"update-评论动态/回复"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/comment"
)
@PostMapping
(
"/comment"
)
...
@@ -96,10 +111,13 @@ public class DynamicController extends BaseController {
...
@@ -96,10 +111,13 @@ public class DynamicController extends BaseController {
@RequestParam
(
required
=
false
)
Integer
gambitId
,
@RequestParam
(
required
=
false
)
Integer
id
,
@RequestParam
(
required
=
false
)
Integer
gambitId
,
@RequestParam
(
required
=
false
)
Integer
id
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
,
@RequestParam
(
required
=
false
)
String
description
,
@RequestParam
(
required
=
false
)
String
description
,
@RequestParam
(
required
=
false
)
List
<
String
>
gambitName
)
{
@RequestParam
(
required
=
false
)
List
<
String
>
gambitName
,
@RequestParam
(
required
=
false
)
Integer
needSort
)
{
return
ResultBody
.
success
(
return
ResultBody
.
success
(
dynamicService
.
dynamicList
(
dynamicService
.
dynamicList
(
pageNo
,
pageSize
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
gambitId
,
id
,
userAccountId
,
description
,
gambitName
));
pageNo
,
pageSize
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
gambitId
,
id
,
userAccountId
,
description
,
gambitName
,
needSort
));
}
}
@ApiOperation
(
value
=
"动态 列表(未登录)"
)
@ApiOperation
(
value
=
"动态 列表(未登录)"
)
...
@@ -110,10 +128,12 @@ public class DynamicController extends BaseController {
...
@@ -110,10 +128,12 @@ public class DynamicController extends BaseController {
@RequestParam
(
required
=
false
)
Integer
gambitId
,
@RequestParam
(
required
=
false
)
Integer
id
,
@RequestParam
(
required
=
false
)
Integer
gambitId
,
@RequestParam
(
required
=
false
)
Integer
id
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
,
@RequestParam
(
required
=
false
)
String
description
,
@RequestParam
(
required
=
false
)
String
description
,
@RequestParam
(
required
=
false
)
List
<
String
>
gambitName
)
{
@RequestParam
(
required
=
false
)
List
<
String
>
gambitName
,
@RequestParam
(
required
=
false
)
Integer
needSort
)
{
return
ResultBody
.
success
(
return
ResultBody
.
success
(
dynamicService
.
dynamicList
(
dynamicService
.
dynamicList
(
pageNo
,
pageSize
,
0
,
gambitId
,
id
,
userAccountId
,
description
,
gambitName
));
pageNo
,
pageSize
,
0
,
gambitId
,
id
,
userAccountId
,
description
,
gambitName
,
needSort
));
}
}
@ApiOperation
(
value
=
"new-小程序-返回最新5条带动态的图片"
)
@ApiOperation
(
value
=
"new-小程序-返回最新5条带动态的图片"
)
...
...
release-service/src/main/java/com/mmc/csf/release/dao/DynamicDao.java
浏览文件 @
bc268fdc
...
@@ -94,9 +94,9 @@ public interface DynamicDao {
...
@@ -94,9 +94,9 @@ public interface DynamicDao {
* @param pageSize 页面大小
* @param pageSize 页面大小
* @return {@link List}<{@link ForumDynamicDO}>
* @return {@link List}<{@link ForumDynamicDO}>
*/
*/
List
<
ForumDynamicDO
>
dynamicList
(
int
itemIndex
,
Integer
pageSize
,
Integer
id
,
Integer
userAccountIds
,
String
description
);
List
<
ForumDynamicDO
>
dynamicList
(
int
itemIndex
,
Integer
pageSize
,
Integer
id
,
Integer
userAccountIds
,
String
description
,
Integer
needSort
);
List
<
ForumDynamicDO
>
dynamicListGambit
(
int
itemIndex
,
Integer
pageSize
,
Integer
id
,
Integer
userAccountIds
,
Integer
gambitId
);
List
<
ForumDynamicDO
>
dynamicListGambit
(
int
itemIndex
,
Integer
pageSize
,
Integer
id
,
Integer
userAccountIds
,
Integer
gambitId
,
Integer
needSort
);
/**
/**
* 列表动态图片
* 列表动态图片
...
@@ -133,6 +133,9 @@ public interface DynamicDao {
...
@@ -133,6 +133,9 @@ public interface DynamicDao {
void
insertResource
(
void
insertResource
(
@Param
(
"dynamicId"
)
Integer
dynamicId
,
@Param
(
"type"
)
int
type
,
@Param
(
"url"
)
String
url
);
@Param
(
"dynamicId"
)
Integer
dynamicId
,
@Param
(
"type"
)
int
type
,
@Param
(
"url"
)
String
url
);
void
deleteResource
(
@Param
(
"dynamicId"
)
Integer
dynamicId
);
void
updateDynamicDescription
(
@Param
(
"dynamicId"
)
Integer
dynamicId
,
@Param
(
"description"
)
String
description
);
List
<
ForumResourceDO
>
listDynamicResources
(
Integer
dynamicId
);
List
<
ForumResourceDO
>
listDynamicResources
(
Integer
dynamicId
);
List
<
ForumDynamicDO
>
getDynamicComment
(
String
dynamicId
);
List
<
ForumDynamicDO
>
getDynamicComment
(
String
dynamicId
);
...
...
release-service/src/main/java/com/mmc/csf/release/entity/forum/ForumDynamicDO.java
浏览文件 @
bc268fdc
...
@@ -91,6 +91,8 @@ public class ForumDynamicDO extends BaseDO implements Serializable {
...
@@ -91,6 +91,8 @@ public class ForumDynamicDO extends BaseDO implements Serializable {
@ApiModelProperty
(
""
)
@ApiModelProperty
(
""
)
private
Integer
transpond
;
private
Integer
transpond
;
@ApiModelProperty
(
"话题id"
)
private
Integer
gambitId
;
public
ForumDynamicDO
(
DynamicVO
dynamicVO
)
{
public
ForumDynamicDO
(
DynamicVO
dynamicVO
)
{
this
.
gambitIcon
=
dynamicVO
.
getGambitIcon
();
this
.
gambitIcon
=
dynamicVO
.
getGambitIcon
();
this
.
gambitCover
=
dynamicVO
.
getGambitCover
();
this
.
gambitCover
=
dynamicVO
.
getGambitCover
();
...
...
release-service/src/main/java/com/mmc/csf/release/service/DynamicService.java
浏览文件 @
bc268fdc
...
@@ -7,6 +7,7 @@ import com.mmc.csf.common.util.web.ResultBody;
...
@@ -7,6 +7,7 @@ import com.mmc.csf.common.util.web.ResultBody;
import
com.mmc.csf.release.entity.gambit.ForumAttentionDO
;
import
com.mmc.csf.release.entity.gambit.ForumAttentionDO
;
import
com.mmc.csf.release.forum.vo.CommentVO
;
import
com.mmc.csf.release.forum.vo.CommentVO
;
import
com.mmc.csf.release.forum.vo.DynamicVO
;
import
com.mmc.csf.release.forum.vo.DynamicVO
;
import
com.mmc.csf.release.forum.vo.UpdateDynamicDO
;
import
com.mmc.csf.release.gambit.qo.ForumGambitQO
;
import
com.mmc.csf.release.gambit.qo.ForumGambitQO
;
import
com.mmc.csf.release.gambit.qo.PostingLeaderboardQO
;
import
com.mmc.csf.release.gambit.qo.PostingLeaderboardQO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,7 +17,7 @@ import java.util.List;
...
@@ -16,7 +17,7 @@ import java.util.List;
*/
*/
public
interface
DynamicService
{
public
interface
DynamicService
{
/**
/**
* 插入
动态
* 插入
帖子
*
*
* @param dynamicVO 动态
* @param dynamicVO 动态
* @return {@link ResultBody}
* @return {@link ResultBody}
...
@@ -24,6 +25,11 @@ public interface DynamicService {
...
@@ -24,6 +25,11 @@ public interface DynamicService {
ResultBody
insertDynamic
(
DynamicVO
dynamicVO
,
Integer
userAccountId
,
HttpServletRequest
request
);
ResultBody
insertDynamic
(
DynamicVO
dynamicVO
,
Integer
userAccountId
,
HttpServletRequest
request
);
/**
/**
* 修改帖子
* @return {@link ResultBody}
*/
ResultBody
updateDynamic
(
UpdateDynamicDO
updateDynamicDO
);
/**
* 点赞动态
* 点赞动态
*
*
* @param userId 用户id
* @param userId 用户id
...
@@ -33,6 +39,14 @@ public interface DynamicService {
...
@@ -33,6 +39,14 @@ public interface DynamicService {
ResultBody
likeDynamic
(
Integer
userId
,
Integer
dynamicId
);
ResultBody
likeDynamic
(
Integer
userId
,
Integer
dynamicId
);
/**
/**
* 返回剩余可投票次数
* @param gambitId 帖子id
* @param userAccountId 用户id
* @return {@link ResultBody}
*/
ResultBody
getRemainingVotes
(
Integer
gambitId
,
Integer
userAccountId
);
/**
* 评论动态
* 评论动态
*
*
* @param commentVO 评论信息
* @param commentVO 评论信息
...
@@ -58,7 +72,7 @@ public interface DynamicService {
...
@@ -58,7 +72,7 @@ public interface DynamicService {
ResultBody
dynamicDetails
(
Integer
dynamicId
,
Integer
userId
,
HttpServletRequest
request
);
ResultBody
dynamicDetails
(
Integer
dynamicId
,
Integer
userId
,
HttpServletRequest
request
);
PageResult
dynamicList
(
PageResult
dynamicList
(
Integer
pageNo
,
Integer
pageSize
,
Integer
userAccountId
,
Integer
gambitId
,
Integer
id
,
Integer
userId
,
String
description
,
List
<
String
>
gambitName
);
Integer
pageNo
,
Integer
pageSize
,
Integer
userAccountId
,
Integer
gambitId
,
Integer
id
,
Integer
userId
,
String
description
,
List
<
String
>
gambitName
,
Integer
needSort
);
ResultBody
recentNewsList
(
Integer
userAccountId
);
ResultBody
recentNewsList
(
Integer
userAccountId
);
...
...
release-service/src/main/java/com/mmc/csf/release/service/impl/DynamicServiceImpl.java
浏览文件 @
bc268fdc
...
@@ -10,8 +10,10 @@ import java.util.stream.Collectors;
...
@@ -10,8 +10,10 @@ import java.util.stream.Collectors;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.mmc.csf.common.util.redis.RedisConstant
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
...
@@ -67,6 +69,9 @@ public class DynamicServiceImpl implements DynamicService {
...
@@ -67,6 +69,9 @@ public class DynamicServiceImpl implements DynamicService {
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
@Value
(
"${iuav.userapp.url}"
)
@Value
(
"${iuav.userapp.url}"
)
private
String
userApp
;
private
String
userApp
;
...
@@ -167,15 +172,39 @@ public class DynamicServiceImpl implements DynamicService {
...
@@ -167,15 +172,39 @@ public class DynamicServiceImpl implements DynamicService {
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
updateDynamic
(
UpdateDynamicDO
updateDynamicDO
)
{
List
<
MediaVO
>
mediaVOList
=
updateDynamicDO
.
getMediaVO
();
dynamicDao
.
deleteResource
(
updateDynamicDO
.
getId
());
if
(
mediaVOList
!=
null
){
for
(
MediaVO
mediaVO
:
mediaVOList
)
{
dynamicDao
.
insertResource
(
updateDynamicDO
.
getId
(),
mediaVO
.
getType
(),
mediaVO
.
getUrl
());
}
}
if
(
updateDynamicDO
.
getDescription
()
!=
null
){
dynamicDao
.
updateDynamicDescription
(
updateDynamicDO
.
getId
(),
updateDynamicDO
.
getDescription
());
}
return
ResultBody
.
success
(
"修改成功"
);
}
@Override
public
ResultBody
likeDynamic
(
Integer
userId
,
Integer
dynamicId
)
{
public
ResultBody
likeDynamic
(
Integer
userId
,
Integer
dynamicId
)
{
// 获取动态信息
// 获取动态信息
ForumDynamicDO
forumDynamicDO
=
dynamicDao
.
getDynamicInfo
(
dynamicId
);
ForumDynamicDO
forumDynamicDO
=
dynamicDao
.
getDynamicInfo
(
dynamicId
);
Integer
gambitId
=
forumDynamicDO
.
getGambitId
();
if
(!
likeDAO
.
isLiked
(
userId
,
dynamicId
))
{
if
(!
likeDAO
.
isLiked
(
userId
,
dynamicId
))
{
if
(!
isVoted
(
gambitId
,
userId
)){
return
ResultBody
.
error
(
"投票已经上上限"
);
}
likeDAO
.
insertLike
(
userId
,
dynamicId
);
likeDAO
.
insertLike
(
userId
,
dynamicId
);
dynamicDao
.
updateDynamicLikeCount
(
dynamicId
,
forumDynamicDO
.
getVersion
());
dynamicDao
.
updateDynamicLikeCount
(
dynamicId
,
forumDynamicDO
.
getVersion
());
dynamicDao
.
forumCount
(
forumDynamicDO
.
getUserAccountId
());
dynamicDao
.
forumCount
(
forumDynamicDO
.
getUserAccountId
());
//评论
//评论
}
else
{
}
else
{
if
(
gambitId
==
1002
||
gambitId
==
1001
||
gambitId
==
1003
){
return
ResultBody
.
error
(
"不能重复投票"
);
}
likeDAO
.
deleteLike
(
userId
,
dynamicId
);
likeDAO
.
deleteLike
(
userId
,
dynamicId
);
dynamicDao
.
updateSubDynamicLikeCount
(
dynamicId
,
forumDynamicDO
.
getVersion
());
dynamicDao
.
updateSubDynamicLikeCount
(
dynamicId
,
forumDynamicDO
.
getVersion
());
dynamicDao
.
forumCountNO
(
forumDynamicDO
.
getUserAccountId
());
dynamicDao
.
forumCountNO
(
forumDynamicDO
.
getUserAccountId
());
...
@@ -183,6 +212,37 @@ public class DynamicServiceImpl implements DynamicService {
...
@@ -183,6 +212,37 @@ public class DynamicServiceImpl implements DynamicService {
return
ResultBody
.
success
();
return
ResultBody
.
success
();
}
}
private
boolean
isVoted
(
Integer
gambitId
,
Integer
userAccountId
)
{
if
(
gambitId
==
1001
||
gambitId
==
1002
||
gambitId
==
1003
)
{
boolean
keyExists
=
stringRedisTemplate
.
hasKey
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
);
if
(
keyExists
){
String
voteStr
=
stringRedisTemplate
.
opsForValue
().
get
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
);
int
voteCount
=
Integer
.
parseInt
(
voteStr
);
if
(
voteCount
>=
5
){
return
false
;
}
stringRedisTemplate
.
opsForValue
().
set
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
,
String
.
valueOf
(
voteCount
+
1
));
return
true
;
}
stringRedisTemplate
.
opsForValue
().
set
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
,
"1"
);
return
true
;
}
return
true
;
}
@Override
public
ResultBody
getRemainingVotes
(
Integer
gambitId
,
Integer
userAccountId
)
{
boolean
keyExists
=
stringRedisTemplate
.
hasKey
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
);
if
(
keyExists
){
String
voteStr
=
stringRedisTemplate
.
opsForValue
().
get
(
RedisConstant
.
VOTE
+
gambitId
+
userAccountId
);
int
voteCount
=
Integer
.
parseInt
(
voteStr
);
//voteCount是已经投票的次数,一个最多投五次
return
ResultBody
.
success
(
5
-
voteCount
);
}
return
ResultBody
.
success
(
5
);
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
commentDynamic
(
CommentVO
commentVO
,
Integer
userAccountId
,
HttpServletRequest
request
)
{
public
ResultBody
commentDynamic
(
CommentVO
commentVO
,
Integer
userAccountId
,
HttpServletRequest
request
)
{
...
@@ -300,7 +360,7 @@ public class DynamicServiceImpl implements DynamicService {
...
@@ -300,7 +360,7 @@ public class DynamicServiceImpl implements DynamicService {
@Override
@Override
public
PageResult
dynamicList
(
public
PageResult
dynamicList
(
Integer
pageNo
,
Integer
pageSize
,
Integer
userId
,
Integer
gambitId
,
Integer
dynId
,
Integer
userAccountIds
,
Integer
pageNo
,
Integer
pageSize
,
Integer
userId
,
Integer
gambitId
,
Integer
dynId
,
Integer
userAccountIds
,
String
description
,
List
<
String
>
gambitName
)
{
String
description
,
List
<
String
>
gambitName
,
Integer
needSort
)
{
Integer
tokenUserId
=
userId
;
Integer
tokenUserId
=
userId
;
Integer
inUserId
=
userAccountIds
;
Integer
inUserId
=
userAccountIds
;
int
count
=
dynamicDao
.
countDynamicList
(
dynId
,
userAccountIds
,
description
);
int
count
=
dynamicDao
.
countDynamicList
(
dynId
,
userAccountIds
,
description
);
...
@@ -308,17 +368,17 @@ public class DynamicServiceImpl implements DynamicService {
...
@@ -308,17 +368,17 @@ public class DynamicServiceImpl implements DynamicService {
return
PageResult
.
buildPage
(
pageNo
,
pageSize
,
0
);
return
PageResult
.
buildPage
(
pageNo
,
pageSize
,
0
);
}
}
int
itemIndex
=
(
pageNo
-
1
)
*
pageSize
;
int
itemIndex
=
(
pageNo
-
1
)
*
pageSize
;
List
<
ForumDynamicDO
>
forumDynamicList
=
dynamicDao
.
dynamicList
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
description
);
List
<
ForumDynamicDO
>
forumDynamicList
=
dynamicDao
.
dynamicList
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
description
,
needSort
);
if
(
gambitName
!=
null
){
if
(
gambitName
!=
null
){
for
(
String
s
:
gambitName
)
{
for
(
String
s
:
gambitName
)
{
Integer
integer
=
dynamicDao
.
gambitName
(
s
);
Integer
integer
=
dynamicDao
.
gambitName
(
s
);
forumDynamicList
=
dynamicDao
.
dynamicListGambit
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
integer
);
forumDynamicList
=
dynamicDao
.
dynamicListGambit
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
integer
,
needSort
);
}
}
}
}
// List<Integer> integers = dynamicDao.gambitName(gambitName);
// List<Integer> integers = dynamicDao.gambitName(gambitName);
if
(
gambitId
!=
null
){
if
(
gambitId
!=
null
){
forumDynamicList
=
dynamicDao
.
dynamicListGambit
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
gambitId
);
forumDynamicList
=
dynamicDao
.
dynamicListGambit
(
itemIndex
,
pageSize
,
dynId
,
userAccountIds
,
gambitId
,
needSort
);
}
}
for
(
ForumDynamicDO
forumDynamicDO
:
forumDynamicList
)
{
for
(
ForumDynamicDO
forumDynamicDO
:
forumDynamicList
)
{
Integer
dynamicId
=
forumDynamicDO
.
getDynamicId
();
Integer
dynamicId
=
forumDynamicDO
.
getDynamicId
();
...
...
release-service/src/main/resources/mapper/forum/DynamicMapper.xml
浏览文件 @
bc268fdc
...
@@ -357,6 +357,11 @@
...
@@ -357,6 +357,11 @@
set check_status = #{status}
set check_status = #{status}
where id = #{dynamicId}
where id = #{dynamicId}
</update>
</update>
<update
id=
"updateDynamicDescription"
>
update forum_dynamic
set description = #{description}
where id = #{dynamicId}
</update>
<delete
id=
"deleteDynamic"
>
<delete
id=
"deleteDynamic"
>
delete
delete
from forum_dynamic
from forum_dynamic
...
@@ -370,10 +375,14 @@
...
@@ -370,10 +375,14 @@
</foreach>
</foreach>
</where>
</where>
</delete>
</delete>
<delete
id=
"deleteResource"
>
delete from forum_resource
where dynamic_id = #{dynamicId}
</delete>
<select
id=
"getDynamicInfo"
resultType=
"com.mmc.csf.release.entity.forum.ForumDynamicDO"
>
<select
id=
"getDynamicInfo"
resultType=
"com.mmc.csf.release.entity.forum.ForumDynamicDO"
>
select id,
select
fd.
id,
version,
version,
user_account_id,
fd.
user_account_id,
root_path,
root_path,
description,
description,
location,
location,
...
@@ -381,9 +390,11 @@
...
@@ -381,9 +390,11 @@
lon,
lon,
likes_count,
likes_count,
comments_count,
comments_count,
create_time
fd.create_time,
from forum_dynamic
gambit_id
where id = #{dynamicId}
from forum_dynamic fd
left join forum_dynamic_gambit on forum_dynamic_gambit.dynamic_id = fd.id
where fd.id = #{dynamicId}
and is_deleted = 0
and is_deleted = 0
</select>
</select>
<select
id=
"countDynamicList"
resultType=
"java.lang.Integer"
>
<select
id=
"countDynamicList"
resultType=
"java.lang.Integer"
>
...
@@ -428,7 +439,14 @@
...
@@ -428,7 +439,14 @@
<if
test=
"description!=null and description!='' "
>
<if
test=
"description!=null and description!='' "
>
and description like concat('%',#{description},'%')
and description like concat('%',#{description},'%')
</if>
</if>
order by create_time desc
<choose>
<when
test=
"needSort != null"
>
order by likes_count desc
</when>
<otherwise>
order by create_time desc
</otherwise>
</choose>
LIMIT #{itemIndex}, #{pageSize}
LIMIT #{itemIndex}, #{pageSize}
</select>
</select>
...
@@ -461,8 +479,14 @@
...
@@ -461,8 +479,14 @@
<if
test=
"userAccountIds!=null"
>
<if
test=
"userAccountIds!=null"
>
and fd.user_account_id=#{userAccountIds}
and fd.user_account_id=#{userAccountIds}
</if>
</if>
ORDER BY
<choose>
fd.create_time DESC
<when
test=
"needSort != null"
>
order by likes_count desc
</when>
<otherwise>
order by create_time desc
</otherwise>
</choose>
LIMIT #{itemIndex}, #{pageSize}
LIMIT #{itemIndex}, #{pageSize}
</select>
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论