Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
26afb2ba
Commit
26afb2ba
authored
4 years ago
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改注册、充值、方案接口
parent
dc063b1d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
177 additions
and
76 deletions
+177
-76
SchemeMapper.java
...apper/src/main/java/cn/wisenergy/mapper/SchemeMapper.java
+7
-0
UserLimitMapper.java
...er/src/main/java/cn/wisenergy/mapper/UserLimitMapper.java
+1
-1
SchemeMapper.xml
wisenergy-mapper/src/main/resources/mapper/SchemeMapper.xml
+11
-0
VolunteerMapper.xml
...ergy-mapper/src/main/resources/mapper/VolunteerMapper.xml
+1
-1
PayRecordShowVo.java
.../src/main/java/cn/wisenergy/model/vo/PayRecordShowVo.java
+2
-1
PayRecordService.java
.../main/java/cn/wisenergy/service/app/PayRecordService.java
+2
-1
SchemeServiceImpl.java
...java/cn/wisenergy/service/app/impl/SchemeServiceImpl.java
+84
-55
UserLimitServiceImpl.java
...a/cn/wisenergy/service/app/impl/UserLimitServiceImpl.java
+6
-6
UserLoginServiceImpl.java
...a/cn/wisenergy/service/app/impl/UserLoginServiceImpl.java
+28
-9
VolunteerManager.java
...in/java/cn/wisenergy/service/common/VolunteerManager.java
+23
-1
SchemeController.java
.../wisenergy/web/admin/controller/app/SchemeController.java
+12
-0
UserLoginController.java
...senergy/web/admin/controller/app/UserLoginController.java
+0
-1
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/SchemeMapper.java
View file @
26afb2ba
...
...
@@ -14,5 +14,12 @@ public interface SchemeMapper extends BaseMapper<SchemeInfo> {
List
<
SchemeInfo
>
getList
(
Map
<
String
,
Object
>
map
);
/**
* 编辑
* @param schemeInfo 编辑信息
* @return 结果
*/
int
edit
(
SchemeInfo
schemeInfo
);
int
count
();
}
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UserLimitMapper.java
View file @
26afb2ba
...
...
@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
* @author 86187
*/
public
interface
UserLimitMapper
extends
BaseMapper
<
UserLimit
>
{
UserLimi
t
add
(
UserLimit
userLimit
);
in
t
add
(
UserLimit
userLimit
);
int
edit
(
UserLimit
userLimit
);
...
...
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/resources/mapper/SchemeMapper.xml
View file @
26afb2ba
...
...
@@ -70,6 +70,17 @@
</where>
</select>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.SchemeInfo"
>
UPDATE
<include
refid=
"table"
/>
<set>
<include
refid=
"updateCondition"
/>
</set>
<where>
id = #{id}
</where>
</update>
<select
id=
"count"
resultType=
"java.lang.Integer"
>
select count(1)
from
...
...
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/resources/mapper/VolunteerMapper.xml
View file @
26afb2ba
...
...
@@ -113,7 +113,7 @@
<if
test=
"downGrade != null"
>
and lowest_mark >#{downGrade}
</if>
<if
test=
"volunteerIds != null "
>
<if
test=
"volunteerIds != null
and volunteerIds.size > 0
"
>
and id NOT IN
<foreach
collection=
"volunteerIds"
index=
"index"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
...
...
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/vo/PayRecordShowVo.java
View file @
26afb2ba
...
...
@@ -11,7 +11,8 @@ import java.util.Date;
*@ Description: 充值记录展示Vo
*@ Author : 86187
*@ Date : 2021/1/13 17:14
*/
* @author 86187
*/
@Data
@ApiModel
(
value
=
"PayRecordShowVo"
)
public
class
PayRecordShowVo
implements
Serializable
{
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/PayRecordService.java
View file @
26afb2ba
...
...
@@ -11,7 +11,8 @@ import com.github.pagehelper.PageInfo;
*@ Description: 充值记录接口定义
*@ Author : 86187
*@ Date : 2021/1/13 17:13
*/
* @author 86187
*/
public
interface
PayRecordService
{
/**
* 获取用户充值列表
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/SchemeServiceImpl.java
View file @
26afb2ba
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLimitServiceImpl.java
View file @
26afb2ba
...
...
@@ -62,6 +62,12 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
}
Integer
userId
=
addLimitVo
.
getUserId
();
//判断用户查询次数信息是否存在
UserLimit
userLimit
=
userLimitMapper
.
getByUserId
(
userId
);
if
(
null
==
userLimit
)
{
return
R
.
error
(
"用户查询信息不存在!"
);
}
//1、充值卡
if
(
PayType
.
REFILL_CARD
.
getCode
().
equals
(
addLimitVo
.
getPayType
()))
{
if
(
StringUtils
.
isBlank
(
addLimitVo
.
getPassword
()))
{
...
...
@@ -74,9 +80,6 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
return
R
.
error
(
"充值卡信息不存在!"
);
}
//获取用户查询次数信息
UserLimit
userLimit
=
userLimitMapper
.
getByUserId
(
userId
);
//增加用户可用查询次数
Integer
usableNumber
=
userLimit
.
getUsableLimit
()
+
cardInfo
.
getLimit
();
...
...
@@ -98,9 +101,6 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
//根据支付的金额,查询用户新增查询次数
Price
price
=
priceMapper
.
getByMoney
(
addLimitVo
.
getPayMoney
());
//获取用户查询次数信息
UserLimit
userLimit
=
userLimitMapper
.
getByUserId
(
userId
);
//增加用户可用查询次数
Integer
usableNumber
=
userLimit
.
getUsableLimit
()
+
price
.
getUseLimit
();
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserLoginServiceImpl.java
View file @
26afb2ba
...
...
@@ -3,9 +3,11 @@ package cn.wisenergy.service.app.impl;
import
cn.wisenergy.common.utils.Md5Util
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.LoginRecordMapper
;
import
cn.wisenergy.mapper.UserLimitMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.model.app.LoginRecord
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.UserLimit
;
import
cn.wisenergy.model.enums.OperationTypeEnum
;
import
cn.wisenergy.model.vo.UpdatePasswordVo
;
import
cn.wisenergy.model.vo.UserInfoVo
;
...
...
@@ -21,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author 86187
...
...
@@ -40,8 +43,12 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
@Autowired
private
SendSmsSerVice
sendSmsSerVice
;
@Autowired
private
UserLimitMapper
userLimitMapper
;
private
static
final
int
ERROR_CODE
=
500
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
R
<
UserInfoVo
>
register
(
UserRegisterVo
userVo
)
{
log
.
info
(
"volunteer-service[]UserLoginServiceImpl[]register[]input.param.userVo:"
+
userVo
);
...
...
@@ -69,7 +76,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
//3、给密码加密 加密规则,电话号码+明文密码
String
secret
=
Md5Util
.
digestMD5
(
password
+
phone
);
//
3
、添加用户信息
//
4
、添加用户信息
User
userInfo
=
new
User
();
userInfo
.
setPhone
(
phone
);
userInfo
.
setPassword
(
secret
);
...
...
@@ -80,20 +87,32 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
return
R
.
error
(
"考生注册失败!"
);
}
//4、保存操作记录
User
user
=
usersMapper
.
getByPhone
(
userVo
.
getPhone
());
//5、保存用户查询信息
UserLimit
addLimit
=
new
UserLimit
();
addLimit
.
setUserId
(
userId
);
addLimit
.
setUseLimit
(
0
);
addLimit
.
setUsableLimit
(
0
);
addLimit
.
setTotalLimit
(
0
);
int
limit
=
userLimitMapper
.
add
(
addLimit
);
if
(
limit
==
0
)
{
return
R
.
error
(
"注册添加用户查询信息失败!"
);
}
//6、保存操作记录
LoginRecord
loginRecord
=
new
LoginRecord
();
loginRecord
.
setType
(
OperationTypeEnum
.
USER_REGISTER
.
getCode
());
loginRecord
.
setUserId
(
user
.
getId
());
loginRecord
.
setUserId
(
user
Info
.
getId
());
String
name
=
OperationTypeEnum
.
getByCode
(
OperationTypeEnum
.
USER_REGISTER
.
getCode
());
loginRecord
.
setOperationName
(
name
);
loginRecordMapper
.
add
(
loginRecord
);
int
record
=
loginRecordMapper
.
add
(
loginRecord
);
if
(
record
==
0
)
{
return
R
.
error
(
"注册保存记录失败!"
);
}
//
5
、封装返回参数
//
7
、封装返回参数
UserInfoVo
userInfoVo
=
new
UserInfoVo
();
userInfoVo
.
setUserId
(
user
.
getId
());
userInfoVo
.
setUserName
(
user
.
getUserName
());
userInfoVo
.
setPhone
(
user
.
getPhone
());
userInfoVo
.
setUserId
(
userInfo
.
getId
());
userInfoVo
.
setPhone
(
userInfo
.
getPhone
());
return
R
.
ok
(
userInfoVo
);
}
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/common/VolunteerManager.java
View file @
26afb2ba
package
cn
.
wisenergy
.
service
.
common
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.enums.CardStatus
;
...
...
@@ -7,10 +8,12 @@ import cn.wisenergy.model.enums.PayType;
import
cn.wisenergy.model.vo.AddLimitVo
;
import
cn.wisenergy.service.app.UserVolunteerService
;
import
cn.wisenergy.service.app.VolunteerService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -56,6 +59,9 @@ public class VolunteerManager {
@Autowired
private
VolunteerService
volunteerService
;
@Autowired
private
VolunteerMapper
volunteerMapper
;
/**
* 更新用户查询信息并保存扣减记录
*
...
...
@@ -216,7 +222,7 @@ public class VolunteerManager {
* @param scoreInfo 成绩信息
* @return true or false
*/
@Transactional
()
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateAndUserInfo
(
User
user
,
ScoreInfo
scoreInfo
)
{
//1、更新用户信息
int
count
=
usersMapper
.
edit
(
user
);
...
...
@@ -257,4 +263,20 @@ public class VolunteerManager {
throw
new
RuntimeException
(
"保存志愿信息失败!"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
deleteSchemeAndVolunteer
(
SchemeInfo
schemeInfo
,
Integer
schemeId
,
Integer
size
)
{
//更行方案状态为删除
int
sum
=
schemeMapper
.
edit
(
schemeInfo
);
if
(
sum
==
0
)
{
return
false
;
}
//更行志愿状态为删除
int
count
=
volunteerMapper
.
updateBySchemeId
(
schemeId
);
if
(
size
!=
count
)
{
return
false
;
}
return
true
;
}
}
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/SchemeController.java
View file @
26afb2ba
...
...
@@ -88,4 +88,16 @@ public class SchemeController {
return
schemeService
.
getSchemeList
(
queryVo
);
}
@ApiOperation
(
value
=
"获取方案列表"
,
notes
=
"获取方案列表"
,
httpMethod
=
"DELETE"
)
@ApiImplicitParam
(
name
=
"schemeId"
,
value
=
"方案id"
,
dataType
=
"schemeId"
)
@DeleteMapping
(
"/delete"
)
public
R
<
Boolean
>
delete
(
Integer
schemeId
)
{
log
.
info
(
"volunteer-service[]SchemeController[]getSchemeList[]input.param.schemeId:"
+
schemeId
);
if
(
null
==
schemeId
)
{
return
R
.
error
(
"入参为空!"
);
}
return
schemeService
.
deleteById
(
schemeId
);
}
}
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserLoginController.java
View file @
26afb2ba
...
...
@@ -2,7 +2,6 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.Banner
;
import
cn.wisenergy.model.vo.*
;
import
cn.wisenergy.service.app.UserLoginService
;
import
io.swagger.annotations.Api
;
...
...
This diff is collapsed.
Click to expand it.
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