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
de2b0576
Commit
de2b0576
authored
Mar 10, 2021
by
liaoanyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加vip客户信息导出功能
parent
7b5faac3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
10 deletions
+103
-10
StaffMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/StaffMapper.java
+7
-2
StaffMapper.xml
wisenergy-mapper/src/main/resources/mapper/StaffMapper.xml
+8
-0
StaffUserVipService.java
...in/java/cn/wisenergy/service/app/StaffUserVipService.java
+10
-0
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+5
-0
StaffUserVipServiceImpl.java
...n/wisenergy/service/app/impl/StaffUserVipServiceImpl.java
+63
-8
StaffUserVipController.java
...ergy/web/admin/controller/app/StaffUserVipController.java
+10
-0
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/StaffMapper.java
View file @
de2b0576
package
cn
.
wisenergy
.
mapper
;
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.Banner
;
import
cn.wisenergy.model.app.Banner
;
import
cn.wisenergy.model.app.Staff
;
import
cn.wisenergy.model.app.Staff
;
import
cn.wisenergy.model.dto.StaffDto
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -53,4 +51,11 @@ public interface StaffMapper extends BaseMapper<Banner> {
...
@@ -53,4 +51,11 @@ public interface StaffMapper extends BaseMapper<Banner> {
* @return
* @return
*/
*/
Staff
getStaff
(
Map
<
String
,
Object
>
map
);
Staff
getStaff
(
Map
<
String
,
Object
>
map
);
/**
*
* @param id 用户id
* @return 用户信息
*/
Staff
getById
(
@Param
(
"id"
)
Integer
id
);
}
}
wisenergy-mapper/src/main/resources/mapper/StaffMapper.xml
View file @
de2b0576
...
@@ -99,6 +99,14 @@
...
@@ -99,6 +99,14 @@
</update>
</update>
<select
id=
"getById"
resultMap=
"staffMap"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
id = #{id}
</where>
</select>
<select
id=
"getUserNumbers"
resultType=
"java.lang.Integer"
>
<select
id=
"getUserNumbers"
resultType=
"java.lang.Integer"
>
SELECT COUNT(id)
SELECT COUNT(id)
FROM
FROM
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/StaffUserVipService.java
View file @
de2b0576
...
@@ -4,10 +4,12 @@ import cn.wisenergy.common.utils.R;
...
@@ -4,10 +4,12 @@ import cn.wisenergy.common.utils.R;
import
cn.wisenergy.model.app.Local
;
import
cn.wisenergy.model.app.Local
;
import
cn.wisenergy.model.dto.UserInfoDto
;
import
cn.wisenergy.model.dto.UserInfoDto
;
import
cn.wisenergy.model.vo.AccountLoginVo
;
import
cn.wisenergy.model.vo.AccountLoginVo
;
import
cn.wisenergy.model.vo.UserQueryVo
;
import
cn.wisenergy.model.vo.UserVipCommitVo
;
import
cn.wisenergy.model.vo.UserVipCommitVo
;
import
cn.wisenergy.model.vo.UserVipQueryVo
;
import
cn.wisenergy.model.vo.UserVipQueryVo
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
public
interface
StaffUserVipService
{
public
interface
StaffUserVipService
{
...
@@ -47,4 +49,12 @@ public interface StaffUserVipService {
...
@@ -47,4 +49,12 @@ public interface StaffUserVipService {
* @return true:成功 false:失败
* @return true:成功 false:失败
*/
*/
R
<
Boolean
>
addUserVolunteer
(
String
ids
,
Integer
userId
,
String
name
);
R
<
Boolean
>
addUserVolunteer
(
String
ids
,
Integer
userId
,
String
name
);
/**
* 导出excel
* @param queryVo 用户
* @param response
* @return Excel数据
*/
R
<
Boolean
>
downExcel
(
UserVipQueryVo
queryVo
,
HttpServletResponse
response
);
}
}
\ No newline at end of file
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
de2b0576
...
@@ -78,6 +78,11 @@ public interface UserService {
...
@@ -78,6 +78,11 @@ public interface UserService {
R
<
List
<
User
>>
test
();
R
<
List
<
User
>>
test
();
/**
* 提交vip用户信息
* @param userInfo 用户信息
* @return 用户相关信息
*/
R
<
UserInfoVo
>
commitUserVipInfo
(
UserVipCommitVo
userInfo
);
R
<
UserInfoVo
>
commitUserVipInfo
(
UserVipCommitVo
userInfo
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/StaffUserVipServiceImpl.java
View file @
de2b0576
...
@@ -8,13 +8,11 @@ import cn.wisenergy.model.app.*;
...
@@ -8,13 +8,11 @@ import cn.wisenergy.model.app.*;
import
cn.wisenergy.model.dto.UserCommitDto
;
import
cn.wisenergy.model.dto.UserCommitDto
;
import
cn.wisenergy.model.dto.UserDto
;
import
cn.wisenergy.model.dto.UserDto
;
import
cn.wisenergy.model.dto.UserInfoDto
;
import
cn.wisenergy.model.dto.UserInfoDto
;
import
cn.wisenergy.model.vo.AccountLoginVo
;
import
cn.wisenergy.model.vo.*
;
import
cn.wisenergy.model.vo.UserInfoVo
;
import
cn.wisenergy.model.vo.UserVipCommitVo
;
import
cn.wisenergy.model.vo.UserVipQueryVo
;
import
cn.wisenergy.service.app.StaffUserVipService
;
import
cn.wisenergy.service.app.StaffUserVipService
;
import
cn.wisenergy.service.common.UserVipManager
;
import
cn.wisenergy.service.common.UserVipManager
;
import
cn.wisenergy.service.common.VolunteerManager
;
import
cn.wisenergy.service.common.VolunteerManager
;
import
com.alibaba.excel.EasyExcel
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
...
@@ -26,10 +24,9 @@ import org.springframework.stereotype.Service;
...
@@ -26,10 +24,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.Map
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -248,4 +245,62 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
...
@@ -248,4 +245,62 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
}
}
@Override
public
R
<
Boolean
>
downExcel
(
UserVipQueryVo
queryVo
,
HttpServletResponse
response
)
{
log
.
info
(
"StaffUserVipServiceImpl[].downExcel[].input.param:"
+
queryVo
);
if
(
null
==
queryVo
||
null
==
queryVo
.
getStaffId
())
{
return
R
.
error
(
"入参为空"
);
}
queryVo
.
setPageSize
(
null
);
queryVo
.
setPageNo
(
null
);
//获取员工名称
Staff
byId
=
staffMapper
.
getById
(
queryVo
.
getStaffId
());
if
(
null
==
byId
)
{
return
R
.
error
(
"该员工不存在"
);
}
String
staffName
=
byId
.
getStaffName
();
//生成Excel
try
{
// 设置内容格式 以及 编码方式
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
List
<
UserInfoDto
>
list
=
getList
(
queryVo
).
getData
().
getList
();
// 使用java8新特性的stream流去处理数据,把空的数据过滤掉
List
<
UserDto
>
resultBo
=
list
.
stream
().
filter
(
Objects:
:
nonNull
)
.
map
(
t
->
{
return
UserDto
.
builder
()
.
registerTime
(
t
.
getRegisterTime
())
.
source
(
t
.
getSource
()==
1
?
"PC"
:
"APP"
)
.
userName
(
t
.
getUserName
())
.
phone
(
t
.
getPhone
())
.
lastLoginTime
(
t
.
getLastLoginTime
())
.
school
(
t
.
getSchool
())
.
examType
(
t
.
getExamType
()==
1
?
"文化生"
:
t
.
getExamType
()==
2
?
"美术生"
:
t
.
getExamType
()==
3
?
"体育生"
:
"文学编导考生"
)
.
sex
(
t
.
getSex
()==
0
?
"男"
:
"女"
)
.
rechargeTimes
(
t
.
getRechargeTimes
())
.
weChatMoney
(
t
.
getWeChatMoney
())
.
alipayMoney
(
t
.
getAlipayMoney
())
.
lastLoginTime
(
t
.
getLastLoginTime
())
.
cultureGrade
(
t
.
getCultureGrade
())
.
majorGrade
(
t
.
getMajorGrade
())
.
build
();
}).
collect
(
Collectors
.
toList
());
//创建文件名称
Long
lon
=
System
.
currentTimeMillis
();
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
lon
+
".xlsx"
);
// sheet名称
EasyExcel
.
write
(
response
.
getOutputStream
(),
UserDto
.
class
).
sheet
(
staffName
+
lon
.
toString
()).
doWrite
(
resultBo
);
return
R
.
ok
(
0
,
true
);
}
catch
(
Exception
e
)
{
return
R
.
ok
(
1
,
false
);
}
}
}
}
\ No newline at end of file
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/StaffUserVipController.java
View file @
de2b0576
...
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
...
@@ -89,4 +90,13 @@ public class StaffUserVipController {
...
@@ -89,4 +90,13 @@ public class StaffUserVipController {
return
staffUserVipService
.
addUserVolunteer
(
ids
,
userId
,
name
);
return
staffUserVipService
.
addUserVolunteer
(
ids
,
userId
,
name
);
}
}
@ApiOperation
(
value
=
"VIP客户信息Excel导出"
,
notes
=
"VIP客户信息Excel导出"
,
httpMethod
=
"POST"
)
@ApiModelProperty
(
name
=
"queryVo"
,
value
=
"vip客户信息"
,
dataType
=
"UserVipQueryVo"
)
@PostMapping
(
"/downExcel"
)
public
R
<
Boolean
>
downExcel
(
@RequestBody
UserVipQueryVo
queryVo
,
HttpServletResponse
response
){
log
.
info
(
"StaffUserVipController[].downExcel[].input.param:"
+
queryVo
);
return
staffUserVipService
.
downExcel
(
queryVo
,
response
);
}
}
}
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