Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
cms
Commits
eaf999d0
提交
eaf999d0
authored
12月 08, 2023
作者:
刘明祎-运维用途
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加获取用户基本信息的接口让ims调用
上级
7980f652
流水线
#7448
已通过 于阶段
in 2 分 21 秒
变更
3
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
13 行删除
+30
-13
UserPointsController.java
...iuav/user/controller/userpoints/UserPointsController.java
+10
-1
UserPointsService.java
...m/mmc/iuav/user/service/userpoints/UserPointsService.java
+6
-3
UserPointsServiceImpl.java
...v/user/service/userpoints/impl/UserPointsServiceImpl.java
+14
-9
没有找到文件。
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/userpoints/UserPointsController.java
浏览文件 @
eaf999d0
...
@@ -16,6 +16,7 @@ import io.swagger.annotations.*;
...
@@ -16,6 +16,7 @@ import io.swagger.annotations.*;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -75,6 +76,14 @@ public class UserPointsController extends BaseController {
...
@@ -75,6 +76,14 @@ public class UserPointsController extends BaseController {
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/changeUserPoints"
)
@GetMapping
(
"/changeUserPoints"
)
public
ResultBody
changeUserPoints
(
HttpServletRequest
request
,
@RequestParam
(
"id"
)
Integer
id
)
{
public
ResultBody
changeUserPoints
(
HttpServletRequest
request
,
@RequestParam
(
"id"
)
Integer
id
)
{
return
userPointsService
.
changeUserPoints
(
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
id
);
return
userPointsService
.
changeUserPoints
(
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
id
,
0
,
null
);
}
@ApiOperation
(
value
=
"远程调用——积分变动接口"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"/feignChangeUserPoints"
)
@ApiIgnore
public
ResultBody
feignChangeUserPoints
(
HttpServletRequest
request
,
@RequestParam
(
"id"
)
int
changePoint
,
String
reason
)
{
return
userPointsService
.
changeUserPoints
(
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
(),
null
,
changePoint
,
reason
);
}
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/userpoints/UserPointsService.java
浏览文件 @
eaf999d0
...
@@ -25,10 +25,13 @@ public interface UserPointsService {
...
@@ -25,10 +25,13 @@ public interface UserPointsService {
/**
/**
* 改变用户积分,
* 改变用户积分,一种是前端传用户userid和扣除积分的pointChangeTypeId(数据库查找变动积分多少和积分变更原因)
* 另一种是供别的服务使用 直接传入用户userid和变动多少积分changePoint和变动原因
* @param userId 用户id
* @param userId 用户id
* @param pointChangeTypeId 根据这个id去user_points_change_type表中查找需要修改多少积分
* @param pointChangeTypeId 根据这个id去user_points_change_type表中查找需要修改多少积分和原因
* @param changePoint 修改多少积分
* @return {@link ResultBody}
* @return {@link ResultBody}
*/
*/
ResultBody
changeUserPoints
(
Integer
userId
,
Integer
pointChangeTypeId
);
ResultBody
changeUserPoints
(
Integer
userId
,
Integer
pointChangeTypeId
,
int
changePoint
,
String
reason
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/userpoints/impl/UserPointsServiceImpl.java
浏览文件 @
eaf999d0
...
@@ -114,21 +114,25 @@ public class UserPointsServiceImpl implements UserPointsService {
...
@@ -114,21 +114,25 @@ public class UserPointsServiceImpl implements UserPointsService {
}
}
@Override
@Override
public
ResultBody
changeUserPoints
(
Integer
userId
,
Integer
pointChangeTypeId
)
{
public
ResultBody
changeUserPoints
(
Integer
userId
,
Integer
pointChangeTypeId
,
int
changePoint
,
String
reason
)
{
//先根据积分变动id pointChangeTypeId 去找到积分变动类型信息
//先根据积分变动id pointChangeTypeId 去找到积分变动类型信息
UserPointChangeTypeDO
userPointChangeTypeDO
=
userPointsDetailsDao
.
selectChangePoint
(
pointChangeTypeId
);
if
(
pointChangeTypeId
!=
null
)
{
if
(
userPointChangeTypeDO
==
null
)
{
UserPointChangeTypeDO
userPointChangeTypeDO
=
userPointsDetailsDao
.
selectChangePoint
(
pointChangeTypeId
);
return
ResultBody
.
error
(
"扣除积分类型不存在"
);
if
(
userPointChangeTypeDO
==
null
)
{
return
ResultBody
.
error
(
"扣除积分类型不存在"
);
}
//用户更改完积分后如果小于0就代表积分不够 大于0就去修改数据库用户总积分
//改变的积分
changePoint
=
userPointChangeTypeDO
.
getChangePoint
();
//改变积分的原因
reason
=
userPointChangeTypeDO
.
getPointSource
();
}
}
UserPointsDO
userPointsDO
=
userPointsDao
.
selectUserPoints
(
userId
);
UserPointsDO
userPointsDO
=
userPointsDao
.
selectUserPoints
(
userId
);
if
(
userPointsDO
==
null
)
{
if
(
userPointsDO
==
null
)
{
userPointsDO
.
setUserAccountId
(
userId
);
userPointsDO
.
setUserAccountId
(
userId
);
userPointsDO
.
setTotalPoints
(
0
);
userPointsDO
.
setTotalPoints
(
0
);
userPointsDao
.
insertPoints
(
userPointsDO
);
userPointsDao
.
insertPoints
(
userPointsDO
);
}
}
//用户更改完积分后如果小于0就代表积分不够 大于0就去修改数据库用户总积分
//改变的积分
Integer
changePoint
=
userPointChangeTypeDO
.
getChangePoint
();
//改变后的用户总积分
//改变后的用户总积分
Integer
userNowPoints
=
userPointsDO
.
getTotalPoints
()
+
changePoint
;
Integer
userNowPoints
=
userPointsDO
.
getTotalPoints
()
+
changePoint
;
if
(
userNowPoints
<
0
)
{
if
(
userNowPoints
<
0
)
{
...
@@ -136,8 +140,9 @@ public class UserPointsServiceImpl implements UserPointsService {
...
@@ -136,8 +140,9 @@ public class UserPointsServiceImpl implements UserPointsService {
}
}
userPointsDO
.
setTotalPoints
(
userNowPoints
);
userPointsDO
.
setTotalPoints
(
userNowPoints
);
userPointsDao
.
updatePoints
(
userPointsDO
);
userPointsDao
.
updatePoints
(
userPointsDO
);
//添加一条积分变动记录
//添加一条积分变动记录
UserPointsDetails
userPointsDetails
=
new
UserPointsDetails
(
userId
,
changePoint
,
userPointChangeTypeDO
.
getPointSource
()
);
UserPointsDetails
userPointsDetails
=
new
UserPointsDetails
(
userId
,
changePoint
,
reason
);
userPointsDetailsDao
.
insertPointsDetails
(
userPointsDetails
);
userPointsDetailsDao
.
insertPointsDetails
(
userPointsDetails
);
return
ResultBody
.
success
();
return
ResultBody
.
success
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论