Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万成波
safe-campus-bbs
Commits
72a253bb
Commit
72a253bb
authored
Sep 02, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
2ccaa28c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
19 deletions
+76
-19
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
...in/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
+1
-2
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPoints.java
...oints/src/main/java/com/tangguo/domain/BbsUserPoints.java
+18
-1
safe-campus-points/src/main/java/com/tangguo/service/IBbsGradeService.java
...s/src/main/java/com/tangguo/service/IBbsGradeService.java
+8
-0
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
...in/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
+13
-0
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
...va/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
+20
-10
safe-campus-points/src/main/resources/mapper/BbsUserGradeMapper.xml
...s-points/src/main/resources/mapper/BbsUserGradeMapper.xml
+8
-0
safe-campus-points/src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
...src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
+8
-6
No files found.
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
View file @
72a253bb
...
@@ -39,10 +39,9 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
...
@@ -39,10 +39,9 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
@Override
@Override
public
List
<
BbsTopic
>
selectBbsTopicList
(
BbsTopic
topic
)
{
public
List
<
BbsTopic
>
selectBbsTopicList
(
BbsTopic
topic
)
{
LambdaQueryWrapper
<
BbsTopic
>
lqw
=
Wrappers
.
lambdaQuery
();
LambdaQueryWrapper
<
BbsTopic
>
lqw
=
Wrappers
.
lambdaQuery
();
lqw
.
orderByDesc
(
BbsTopic:
:
getCreateTime
);
lqw
.
like
(
StringUtils
.
isNotBlank
(
topic
.
getSource
()),
BbsTopic:
:
getSource
,
topic
.
getSource
());
lqw
.
like
(
StringUtils
.
isNotBlank
(
topic
.
getSource
()),
BbsTopic:
:
getSource
,
topic
.
getSource
());
lqw
.
like
(
StringUtils
.
isNotBlank
(
topic
.
getName
()),
BbsTopic:
:
getName
,
topic
.
getName
());
lqw
.
like
(
StringUtils
.
isNotBlank
(
topic
.
getName
()),
BbsTopic:
:
getName
,
topic
.
getName
());
lqw
.
orderBy
A
sc
(
BbsTopic:
:
getIsTop
);
lqw
.
orderBy
De
sc
(
BbsTopic:
:
getIsTop
);
lqw
.
orderByDesc
(
BbsTopic:
:
getTopTime
);
lqw
.
orderByDesc
(
BbsTopic:
:
getTopTime
);
lqw
.
orderByAsc
(
BbsTopic:
:
getSort
);
lqw
.
orderByAsc
(
BbsTopic:
:
getSort
);
return
bbsTopicMapper
.
selectList
(
lqw
);
return
bbsTopicMapper
.
selectList
(
lqw
);
...
...
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPoints.java
View file @
72a253bb
...
@@ -13,6 +13,8 @@ import lombok.NoArgsConstructor;
...
@@ -13,6 +13,8 @@ import lombok.NoArgsConstructor;
import
lombok.ToString
;
import
lombok.ToString
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
/**
* 用户积分对象 bbs_user_points
* 用户积分对象 bbs_user_points
*
*
...
@@ -48,6 +50,21 @@ public class BbsUserPoints extends BaseEntity {
...
@@ -48,6 +50,21 @@ public class BbsUserPoints extends BaseEntity {
@ApiModelProperty
(
"当前积分"
)
@ApiModelProperty
(
"当前积分"
)
private
Integer
currentPoints
;
private
Integer
currentPoints
;
/** 当前等级编码 */
@Excel
(
name
=
"当前等级编码"
)
@ApiModelProperty
(
"当前等级编码"
)
private
String
gradeCode
;
/** 当前等级名称 */
@Excel
(
name
=
"当前等级名称"
)
@ApiModelProperty
(
"当前等级名称"
)
private
String
gradeName
;
/** 等级升级时间 */
@Excel
(
name
=
"等级升级时间"
)
@ApiModelProperty
(
"等级升级时间"
)
private
Date
lastUpgradeTime
;
/**
/**
* 用户姓名
* 用户姓名
...
@@ -57,7 +74,7 @@ public class BbsUserPoints extends BaseEntity {
...
@@ -57,7 +74,7 @@ public class BbsUserPoints extends BaseEntity {
private
String
nikeName
;
private
String
nikeName
;
/**
/**
* 用户部门
名称
* 用户部门
*/
*/
@Excel
(
name
=
"部门名称"
)
@Excel
(
name
=
"部门名称"
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
...
...
safe-campus-points/src/main/java/com/tangguo/service/IBbsGradeService.java
View file @
72a253bb
...
@@ -53,4 +53,12 @@ public interface IBbsGradeService extends IService<BbsGrade> {
...
@@ -53,4 +53,12 @@ public interface IBbsGradeService extends IService<BbsGrade> {
*/
*/
void
deleteGrade
(
Long
gradeId
);
void
deleteGrade
(
Long
gradeId
);
/**
* 查询初始等级
*
* @return 等级
*/
BbsGrade
getInitialGrade
();
}
}
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
View file @
72a253bb
...
@@ -166,4 +166,17 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
...
@@ -166,4 +166,17 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
this
.
removeById
(
gradeId
);
this
.
removeById
(
gradeId
);
}
}
/**
* 查询初始等级
*
* @return 等级
*/
@Override
public
BbsGrade
getInitialGrade
()
{
return
this
.
getOne
(
Wrappers
.
lambdaQuery
(
BbsGrade
.
class
).
eq
(
BbsGrade:
:
getIsInitial
,
IsInitialGrade
.
YES
.
getValue
())
);
}
}
}
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
View file @
72a253bb
package
com
.
tangguo
.
service
.
impl
;
package
com
.
tangguo
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.domain.BbsGrade
;
import
com.tangguo.domain.BbsUserPoints
;
import
com.tangguo.domain.BbsUserPoints
;
import
com.tangguo.domain.BbsUserPointsDetail
;
import
com.tangguo.domain.BbsUserPointsDetail
;
import
com.tangguo.domain.dto.PointsDetail
;
import
com.tangguo.domain.dto.PointsDetail
;
import
com.tangguo.domain.vo.QwmhSysUserVO
;
import
com.tangguo.domain.vo.QwmhSysUserVO
;
import
com.tangguo.mapper.BbsUserPointsMapper
;
import
com.tangguo.mapper.BbsUserPointsMapper
;
import
com.tangguo.service.IBbsGradeService
;
import
com.tangguo.service.IBbsUserPointsDetailService
;
import
com.tangguo.service.IBbsUserPointsDetailService
;
import
com.tangguo.service.IBbsUserPointsService
;
import
com.tangguo.service.IBbsUserPointsService
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -32,11 +32,14 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -32,11 +32,14 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
@Resource
@Resource
private
BbsUserPointsMapper
bbsUserPointsMapper
;
private
BbsUserPointsMapper
bbsUserPointsMapper
;
@Resource
private
BbsUserPointsServiceImpl
pointsServiceImpl
;
@Resource
@Resource
private
IBbsUserPointsDetailService
pointsDetailService
;
private
IBbsUserPointsDetailService
pointsDetailService
;
@Resource
@Resource
private
BbsUserPointsServiceImpl
userPointsServiceImpl
;
private
IBbsGradeService
gradeService
;
/**
/**
...
@@ -63,14 +66,21 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -63,14 +66,21 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
BbsUserPoints
dbUserPoints
=
this
.
baseMapper
.
selectUserPoints
(
userName
);
BbsUserPoints
dbUserPoints
=
this
.
baseMapper
.
selectUserPoints
(
userName
);
if
(
Objects
.
isNull
(
dbUserPoints
))
{
if
(
Objects
.
isNull
(
dbUserPoints
))
{
QwmhSysUserVO
qwmhSysUser
=
this
.
baseMapper
.
selectQwmhUser
(
userName
);
QwmhSysUserVO
qwmhSysUser
=
this
.
baseMapper
.
selectQwmhUser
(
userName
);
if
(
Objects
.
nonNull
(
qwmhSysUser
))
{
if
(
Objects
.
isNull
(
qwmhSysUser
))
{
throw
new
ServiceException
(
"查询用户积分失败,未查询到当前用户数据。"
);
}
else
{
dbUserPoints
=
new
BbsUserPoints
();
dbUserPoints
=
new
BbsUserPoints
();
// 用户初始积分
dbUserPoints
.
setUserName
(
userName
);
dbUserPoints
.
setUserName
(
userName
);
dbUserPoints
.
setAccumulatedPoints
(
0
);
dbUserPoints
.
setAccumulatedPoints
(
0
);
dbUserPoints
.
setCurrentPoints
(
0
);
dbUserPoints
.
setCurrentPoints
(
0
);
// 用户初始等级
BbsGrade
dbGrade
=
this
.
gradeService
.
getInitialGrade
();
if
(
Objects
.
nonNull
(
dbGrade
))
{
dbUserPoints
.
setGradeCode
(
dbGrade
.
getCode
());
dbUserPoints
.
setGradeName
(
dbGrade
.
getName
());
}
this
.
save
(
dbUserPoints
);
this
.
save
(
dbUserPoints
);
}
else
{
throw
new
ServiceException
(
"查询用户积分失败,未查询到当前用户数据。"
);
}
}
}
}
return
dbUserPoints
;
return
dbUserPoints
;
...
@@ -121,7 +131,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -121,7 +131,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
@Override
@Override
public
void
incrUserPoints
(
PointsDetail
detail
)
{
public
void
incrUserPoints
(
PointsDetail
detail
)
{
synchronized
(
detail
.
getUserName
().
intern
())
{
synchronized
(
detail
.
getUserName
().
intern
())
{
this
.
userP
ointsServiceImpl
.
privIncrUserPoints
(
detail
);
this
.
p
ointsServiceImpl
.
privIncrUserPoints
(
detail
);
}
}
}
}
...
@@ -134,7 +144,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -134,7 +144,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
@Override
@Override
public
void
decrUserPoints
(
PointsDetail
detail
)
{
public
void
decrUserPoints
(
PointsDetail
detail
)
{
synchronized
(
detail
.
getUserName
().
intern
())
{
synchronized
(
detail
.
getUserName
().
intern
())
{
this
.
userP
ointsServiceImpl
.
privDecrUserPoints
(
detail
);
this
.
p
ointsServiceImpl
.
privDecrUserPoints
(
detail
);
}
}
}
}
...
@@ -153,7 +163,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -153,7 +163,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
// 更新用户积分
// 更新用户积分
String
userName
=
detail
.
getUserName
();
String
userName
=
detail
.
getUserName
();
BbsUserPoints
userPoints
=
this
.
userP
ointsServiceImpl
.
getUserPoints
(
userName
);
BbsUserPoints
userPoints
=
this
.
p
ointsServiceImpl
.
getUserPoints
(
userName
);
Integer
currentPoints
=
userPoints
.
getCurrentPoints
();
Integer
currentPoints
=
userPoints
.
getCurrentPoints
();
int
incrCurrentPoints
=
currentPoints
+
points
;
int
incrCurrentPoints
=
currentPoints
+
points
;
userPoints
.
setCurrentPoints
(
incrCurrentPoints
);
userPoints
.
setCurrentPoints
(
incrCurrentPoints
);
...
@@ -187,7 +197,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
...
@@ -187,7 +197,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
// 更新用户积分
// 更新用户积分
String
userName
=
detail
.
getUserName
();
String
userName
=
detail
.
getUserName
();
BbsUserPoints
userPoints
=
this
.
userP
ointsServiceImpl
.
getUserPoints
(
userName
);
BbsUserPoints
userPoints
=
this
.
p
ointsServiceImpl
.
getUserPoints
(
userName
);
Integer
currentPoints
=
userPoints
.
getCurrentPoints
();
Integer
currentPoints
=
userPoints
.
getCurrentPoints
();
if
(
points
>
currentPoints
)
{
if
(
points
>
currentPoints
)
{
throw
new
ServiceException
(
"扣减用户积分失败,当前用户可用积分不足。"
);
throw
new
ServiceException
(
"扣减用户积分失败,当前用户可用积分不足。"
);
...
...
safe-campus-points/src/main/resources/mapper/BbsUserGradeMapper.xml
0 → 100644
View file @
72a253bb
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tangguo.mapper.BbsUserGradeMapper"
>
</mapper>
safe-campus-points/src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
View file @
72a253bb
...
@@ -6,14 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -6,14 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectPointsUsers"
resultType=
"com.tangguo.domain.vo.QwmhSysUserVO"
>
<select
id=
"selectPointsUsers"
resultType=
"com.tangguo.domain.vo.QwmhSysUserVO"
>
SELECT
SELECT
uv.
*
,
uv.
user_name
,
g.grad
e_name,
uv.nik
e_name,
IFNULL(p.current_points, 0) AS current_points,
IFNULL(p.current_points, 0) AS current_points,
IFNULL(p.accumulated_points, 0) AS accumulated_points
IFNULL(p.accumulated_points, 0) AS accumulated_points,
IFNULL(p.grade_name, ug.name) AS grade_name
FROM
FROM
qwmh_sys_user_view uv
qwmh_sys_user_view uv
LEFT JOIN
CROSS JOIN (
bbs_user_grade g ON g.user_name = uv.user_name
SELECT (SELECT name FROM bbs_grade WHERE is_initial = 1) AS name
) ug
LEFT JOIN
LEFT JOIN
bbs_user_points p ON p.user_name = uv.user_name
bbs_user_points p ON p.user_name = uv.user_name
<where>
<where>
...
@@ -22,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -22,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</where>
</where>
ORDER BY
ORDER BY
uv.
user_id
uv.
create_time DESC
</select>
</select>
...
...
Write
Preview
Markdown
is supported
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