Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
V
volunteer_service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
licc
volunteer_service
Commits
c496019a
Commit
c496019a
authored
May 19, 2021
by
cy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手动给用户添加查询点数
parent
cbd95f25
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
UserLimitService.java
.../main/java/cn/wisenergy/service/app/UserLimitService.java
+9
-0
UserLimitServiceImpl.java
...a/cn/wisenergy/service/app/impl/UserLimitServiceImpl.java
+43
-0
RefillCardController.java
...energy/web/admin/controller/app/RefillCardController.java
+1
-0
UserLimitController.java
...senergy/web/admin/controller/app/UserLimitController.java
+12
-0
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserLimitService.java
View file @
c496019a
...
...
@@ -42,4 +42,13 @@ public interface UserLimitService {
* @return true or false
*/
R
<
Boolean
>
minusLimitUser
(
UserLimit
userLimit
);
/**
* 给用户添加查询点数
* @param phone
* @param number
* @return
*/
R
<
Boolean
>
addPoint
(
String
phone
,
Integer
number
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLimitServiceImpl.java
View file @
c496019a
...
...
@@ -15,6 +15,9 @@ import org.apache.commons.lang.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.HashMap
;
/**
* @author 86187
*/
...
...
@@ -43,6 +46,9 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
@Autowired
private
RefillCardMapper
refillCardMapper
;
@Autowired
private
UsersMapper
usersMapper
;
@Override
public
R
<
UserLimit
>
getByUserId
(
Integer
userId
)
{
log
.
info
(
"volunteer-service[]UserLimitServiceImpl[]getByUserId[]input.param.userId:"
+
userId
);
...
...
@@ -156,6 +162,8 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
return
R
.
ok
(
1
,
false
);
}
@Override
public
R
<
Boolean
>
minusLimit
(
Integer
userId
)
{
log
.
info
(
"volunteer-service[]UserLimitServiceImpl[]minusLimit[]input.param.userId:"
+
userId
);
...
...
@@ -188,4 +196,39 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
}
return
R
.
ok
(
1
,
false
);
}
@Override
public
R
<
Boolean
>
addPoint
(
String
phone
,
Integer
number
)
{
if
(
StringUtils
.
isBlank
(
phone
)
||
StringUtils
.
isBlank
(
number
+
""
)){
return
R
.
error
(
"入参不能为空!"
);
}
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"phone"
,
phone
);
User
userInfo
=
usersMapper
.
selectOne
(
map
);
if
(
null
==
userInfo
){
return
R
.
error
(
"该账号不存在"
);
}
UserLimit
userLimit
=
new
UserLimit
();
userLimit
.
setUserId
(
userInfo
.
getId
());
QueryWrapper
<
UserLimit
>
userLim
=
new
QueryWrapper
<
UserLimit
>().
eq
(
"user_id"
,
userInfo
.
getId
());
UserLimit
userLimitInfo
=
userLimitMapper
.
selectOne
(
userLim
);
int
add
;
if
(
null
==
userLimitInfo
){
userLimit
.
setTotalLimit
(
number
);
userLimit
.
setUsableLimit
(
number
);
userLimit
.
setCreateTime
(
new
Date
());
userLimit
.
setUpdateTime
(
new
Date
());
add
=
userLimitMapper
.
insert
(
userLimit
);
}
else
{
userLimit
.
setId
(
userLimitInfo
.
getId
());
userLimit
.
setTotalLimit
(
userLimitInfo
.
getTotalLimit
()+
number
);
userLimit
.
setUsableLimit
(
userLimitInfo
.
getUsableLimit
()+
number
);
userLimit
.
setUpdateTime
(
new
Date
());
add
=
userLimitMapper
.
updateById
(
userLimit
);
}
if
(
add
>
0
){
return
R
.
ok
(
0
,
true
);
}
return
R
.
ok
(
1
,
false
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/RefillCardController.java
View file @
c496019a
...
...
@@ -77,4 +77,5 @@ public class RefillCardController {
return
refillCardService
.
createExcel
(
batchNumber
,
response
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserLimitController.java
View file @
c496019a
...
...
@@ -7,6 +7,7 @@ import cn.wisenergy.model.vo.MinusLimitVo;
import
cn.wisenergy.service.app.UserLimitService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -64,5 +65,16 @@ public class UserLimitController {
return
userLimitService
.
minusLimit
(
minusLimitVo
.
getUserId
());
}
@ApiOperation
(
value
=
"给用户添加查询点数"
,
notes
=
"给用户添加查询点数"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"phone"
,
value
=
"号码"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"number"
,
value
=
"充值点数"
,
dataType
=
"int"
)
})
@GetMapping
(
"/addPoint"
)
public
R
<
Boolean
>
addPoint
(
String
phone
,
Integer
number
){
log
.
info
(
"volunteer-service[]UserLimitController[]addPoint[]input.param.phone:"
+
phone
+
"number:"
+
number
);
return
userLimitService
.
addPoint
(
phone
,
number
);
}
}
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