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
d237f380
Commit
d237f380
authored
Feb 07, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增方案下载接口
parent
1d039083
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
95 additions
and
19 deletions
+95
-19
SchemeMapper.java
...apper/src/main/java/cn/wisenergy/mapper/SchemeMapper.java
+12
-0
SchemeMapper.xml
wisenergy-mapper/src/main/resources/mapper/SchemeMapper.xml
+15
-2
SchemeInfo.java
...odel/src/main/java/cn/wisenergy/model/app/SchemeInfo.java
+6
-0
SchemeService.java
...src/main/java/cn/wisenergy/service/app/SchemeService.java
+17
-6
VolunteerService.java
.../main/java/cn/wisenergy/service/app/VolunteerService.java
+6
-4
SchemeServiceImpl.java
...java/cn/wisenergy/service/app/impl/SchemeServiceImpl.java
+16
-0
VolunteerServiceImpl.java
...a/cn/wisenergy/service/app/impl/VolunteerServiceImpl.java
+4
-2
SchemeController.java
.../wisenergy/web/admin/controller/app/SchemeController.java
+17
-3
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+2
-2
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/SchemeMapper.java
View file @
d237f380
...
...
@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import
cn.wisenergy.model.app.SchemeInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -21,5 +22,16 @@ public interface SchemeMapper extends BaseMapper<SchemeInfo> {
*/
int
edit
(
SchemeInfo
schemeInfo
);
/**
* 统计
* @return 数量
*/
int
count
();
/**
* 获取方案信息
* @param id 方案id
* @return 方案信息
*/
SchemeInfo
getById
(
@Param
(
"id"
)
Integer
id
);
}
wisenergy-mapper/src/main/resources/mapper/SchemeMapper.xml
View file @
d237f380
...
...
@@ -6,6 +6,7 @@
<id
column=
"id"
property=
"id"
/>
<result
column=
"scheme_name"
property=
"schemeName"
/>
<result
column=
"upload_time"
property=
"uploadTime"
/>
<result
column=
"file_url"
property=
"fileUrl"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"is_delete"
property=
"isDelete"
/>
<result
column=
"create_time"
property=
"createTime"
/>
...
...
@@ -22,16 +23,17 @@
</sql>
<sql
id=
"cols_exclude_id"
>
scheme_name,upload_time, type,is_delete,create_time,update_time
scheme_name,upload_time,
file_url,
type,is_delete,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{schemeName},#{uploadTime},#{type},#{isDelete},now(),now()
#{schemeName},#{uploadTime},#{
fileUrl},#{
type},#{isDelete},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"schemeName != null"
>
scheme_name = #{schemeName},
</if>
<if
test=
"uploadTime != null"
>
upload_time =#{uploadTime},
</if>
<if
test=
"fileUrl != null"
>
file_url =#{fileUrl},
</if>
<if
test=
"type != null"
>
type =#{type},
</if>
<if
test=
"isDelete != null"
>
is_delete =#{isDelete},
</if>
update_time =now()
...
...
@@ -41,6 +43,7 @@
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"schemeName != null"
>
and scheme_name = #{schemeName}
</if>
<if
test=
"uploadTime != null"
>
and upload_time =#{uploadTime}
</if>
<if
test=
"fileUrl != null"
>
and file_url =#{fileUrl}
</if>
<if
test=
"type != null"
>
and type =#{type}
</if>
<if
test=
"isDelete != null"
>
and is_delete =#{isDelete}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
...
...
@@ -90,4 +93,14 @@
</where>
</select>
<select
id=
"getById"
resultType=
"cn.wisenergy.model.app.SchemeInfo"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
id=#{id}
</where>
</select>
</mapper>
wisenergy-model/src/main/java/cn/wisenergy/model/app/SchemeInfo.java
View file @
d237f380
...
...
@@ -34,6 +34,12 @@ public class SchemeInfo implements Serializable {
@ApiModelProperty
(
value
=
"上传时间"
,
name
=
"uploadTime"
)
private
Date
uploadTime
;
/**
* 上传url
*/
@ApiModelProperty
(
value
=
"上传时间"
,
name
=
"uploadTime"
)
private
String
fileUrl
;
/**
* 1:本科文化一批 2:本科美术一批 3:艺术本科批文学编导
* 4:本科体育 5:专科专业分类6:专科美术一批 7:专科文学编导一批 8:专科体育一批
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/SchemeService.java
View file @
d237f380
...
...
@@ -9,21 +9,23 @@ import com.github.pagehelper.PageInfo;
/**
*
@ Description: 方案接口定义
*
@ Author : 86187
*
@ Date : 2021/1/13 14:50
*/
*
@ Description: 方案接口定义
*
@ Author : 86187
*
@ Date : 2021/1/13 14:50
*/
public
interface
SchemeService
{
/**
* 方案查询
*
* @param schemeVo 查询参数
* @return
方案查询结果列表
* @return 方案查询结果列表
*/
R
<
VolunteerVo
>
getList
(
SchemeVo
schemeVo
);
/**
* 根据方案id,删除方案
*
* @param schemeId 方案id
* @return
*/
...
...
@@ -31,8 +33,17 @@ public interface SchemeService {
/**
* 方案列表查询
*
* @param schemeVo 查询参数
* @return
方案查询结果列表
* @return 方案查询结果列表
*/
R
<
PageInfo
<
SchemeInfo
>>
getSchemeList
(
SchemeQueryVo
schemeVo
);
/**
* 获取方案下载路径
*
* @param schemeId 方案id
* @return 方案下载路径
*/
R
<
String
>
download
(
Integer
schemeId
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/VolunteerService.java
View file @
d237f380
...
...
@@ -24,11 +24,13 @@ public interface VolunteerService extends IService<Volunteer> {
/**
* Excel批量添加方案志愿
* @param file 志愿文件
* @param type 方案类型
*
* @param file 志愿文件
* @param type 方案类型
* @param schemeName 方案名称
* @param response 相应数据
* @param fileUrl 方案url
* @param response 相应数据
* @throws IOException 异常
*/
void
excelAdd
(
MultipartFile
file
,
Integer
type
,
String
schemeName
,
HttpServletResponse
response
)
throws
IOException
;
void
excelAdd
(
MultipartFile
file
,
Integer
type
,
String
schemeName
,
String
fileUrl
,
HttpServletResponse
response
)
throws
IOException
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/SchemeServiceImpl.java
View file @
d237f380
...
...
@@ -303,6 +303,22 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
return
R
.
ok
(
info
);
}
@Override
public
R
<
String
>
download
(
Integer
schemeId
)
{
log
.
info
(
"volunteer-service[]SchemeServiceImpl[]download[]input.param.schemeId:"
+
schemeId
);
if
(
null
==
schemeId
)
{
return
R
.
error
(
"入参为空!"
);
}
//获取方案信息
SchemeInfo
schemeInfo
=
schemeMapper
.
getById
(
schemeId
);
if
(
null
==
schemeInfo
||
StringUtils
.
isBlank
(
schemeInfo
.
getFileUrl
()))
{
return
R
.
error
(
"未上传方案,无法下载!"
);
}
return
R
.
ok
(
schemeInfo
.
getFileUrl
());
}
/**
* 获取文化生志愿列表
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/VolunteerServiceImpl.java
View file @
d237f380
...
...
@@ -50,8 +50,9 @@ public class VolunteerServiceImpl extends ServiceImpl<VolunteerMapper, Volunteer
}
@Override
public
void
excelAdd
(
MultipartFile
file
,
Integer
type
,
String
schemeName
,
HttpServletResponse
response
)
throws
IOException
{
if
(
file
==
null
||
file
.
isEmpty
()
||
null
==
type
||
StringUtils
.
isBlank
(
schemeName
))
{
public
void
excelAdd
(
MultipartFile
file
,
Integer
type
,
String
schemeName
,
String
fileUrl
,
HttpServletResponse
response
)
throws
IOException
{
if
(
file
==
null
||
file
.
isEmpty
()
||
null
==
type
||
StringUtils
.
isBlank
(
schemeName
)
||
StringUtils
.
isBlank
(
fileUrl
))
{
throw
new
BaseException
(
"操作错误"
);
}
...
...
@@ -70,6 +71,7 @@ public class VolunteerServiceImpl extends ServiceImpl<VolunteerMapper, Volunteer
SchemeInfo
schemeInfo
=
new
SchemeInfo
();
schemeInfo
.
setSchemeName
(
schemeName
);
schemeInfo
.
setType
(
type
);
schemeInfo
.
setFileUrl
(
fileUrl
);
schemeInfo
.
setUploadTime
(
new
Date
());
schemeInfo
.
setIsDelete
(
0
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/SchemeController.java
View file @
d237f380
...
...
@@ -54,12 +54,14 @@ public class SchemeController {
@ApiOperation
(
value
=
"Excel批量添加方案志愿"
,
notes
=
"Excel批量添加方案志愿"
)
@PostMapping
(
"/excel/add"
)
public
R
excelAdd
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"type"
)
Integer
type
,
@RequestParam
(
"schemeName"
)
String
schemeName
,
HttpServletResponse
response
)
throws
IOException
{
if
(
file
==
null
||
file
.
isEmpty
()
||
null
==
type
||
StringUtils
.
isBlank
(
schemeName
))
{
@RequestParam
(
"schemeName"
)
String
schemeName
,
@RequestParam
(
"fileUrl"
)
String
fileUrl
,
HttpServletResponse
response
)
throws
IOException
{
if
(
file
==
null
||
file
.
isEmpty
()
||
null
==
type
||
StringUtils
.
isBlank
(
schemeName
)
||
StringUtils
.
isBlank
(
fileUrl
))
{
throw
new
BaseException
(
"操作错误"
);
}
volunteerService
.
excelAdd
(
file
,
type
,
schemeName
,
response
);
volunteerService
.
excelAdd
(
file
,
type
,
schemeName
,
fileUrl
,
response
);
return
R
.
ok
(
"添加成功"
);
}
...
...
@@ -87,4 +89,16 @@ public class SchemeController {
return
schemeService
.
deleteById
(
schemeId
);
}
@ApiOperation
(
value
=
"获取方案下载路径"
,
notes
=
"获取方案下载路径"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"schemeId"
,
value
=
"方案id"
,
dataType
=
"int"
)
@GetMapping
(
"/download"
)
public
R
<
String
>
download
(
Integer
schemeId
)
{
log
.
info
(
"volunteer-service[]SchemeController[]download[]input.param.schemeId:"
+
schemeId
);
if
(
null
==
schemeId
)
{
return
R
.
error
(
"入参为空!"
);
}
return
schemeService
.
download
(
schemeId
);
}
}
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
d237f380
...
...
@@ -40,9 +40,9 @@ spring:
# 启用
enabled
:
true
# 上传文件单个限制
max-file-size
:
5
MB
max-file-size
:
10
MB
# 总限制
max-request-size
:
1
0MB
max-request-size
:
2
0MB
redis
:
database
:
0
...
...
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