Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
c4fc3da1
Commit
c4fc3da1
authored
Jun 29, 2019
by
zhengjie
Browse files
代码生成器优化,新增多数据字典支持,用户修改密码优化
parent
375cdf4d
Changes
32
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/resources/template/generator/admin/Service.ftl
View file @
c4fc3da1
...
@@ -3,16 +3,16 @@ package ${package}.service;
...
@@ -3,16 +3,16 @@ package ${package}.service;
import
$
{
package
}
.domain.$
{
className
}
;
import
$
{
package
}
.domain.$
{
className
}
;
import
$
{
package
}
.service.dto.$
{
className
}
DTO;
import
$
{
package
}
.service.dto.$
{
className
}
DTO;
import
$
{
package
}
.service.dto.$
{
className
}
QueryCriteria;
import
$
{
package
}
.service.dto.$
{
className
}
QueryCriteria;
import
org.springframework.cache.annotation.CacheConfig;
//
import
org.springframework.cache.annotation.CacheConfig;
import
org.springframework.cache.annotation.CacheEvict;
//
import
org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable;
//
import
org.springframework.cache.annotation.Cacheable;
import
org.springframework.data.domain.Pageable;
import
org.springframework.data.domain.Pageable;
/**
/**
*
@author $
{
author
}
*
@author $
{
author
}
*
@date $
{
date
}
*
@date $
{
date
}
*/
*/
@
CacheConfig
(
cacheNames
=
"$
{
changeClassName
}
")
//
@
CacheConfig
(
cacheNames
=
"$
{
changeClassName
}
")
public
interface $
{
className
}
Service
{
public
interface $
{
className
}
Service
{
/
**
/
**
...
@@ -21,7 +21,7 @@ public interface ${className}Service {
...
@@ -21,7 +21,7 @@ public interface ${className}Service {
*
@
param
pageable
*
@
param
pageable
*
@
return
*
@
return
*
/
*
/
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
//
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
,
P
ageable
pageable
)
;
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
,
P
ageable
pageable
)
;
/
**
/
**
...
@@ -29,7 +29,7 @@ public interface ${className}Service {
...
@@ -29,7 +29,7 @@ public interface ${className}Service {
*
@
param
criteria
*
@
param
criteria
*
@
return
*
@
return
*
/
*
/
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
//
@
C
acheable
(
keyGenerator
=
"keyGenerator"
)
public
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
)
;
public
O
bject
queryAll
(
$
{
className
}
Q
ueryCriteria
criteria
)
;
/
**
/
**
...
@@ -37,7 +37,7 @@ public interface ${className}Service {
...
@@ -37,7 +37,7 @@ public interface ${className}Service {
*
@
param
$
{
pkChangeColName
}
*
@
param
$
{
pkChangeColName
}
*
@
return
*
@
return
*
/
*
/
@
C
acheable
(
key
=
"#p0"
)
//
@
C
acheable
(
key
=
"#p0"
)
$
{
className
}
DTO
findById
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
$
{
className
}
DTO
findById
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
/
**
/
**
...
@@ -45,20 +45,20 @@ public interface ${className}Service {
...
@@ -45,20 +45,20 @@ public interface ${className}Service {
*
@
param
resources
*
@
param
resources
*
@
return
*
@
return
*
/
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
$
{
className
}
DTO
create
(
$
{
className
}
resources
)
;
$
{
className
}
DTO
create
(
$
{
className
}
resources
)
;
/
**
/
**
*
update
*
update
*
@
param
resources
*
@
param
resources
*
/
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
void
update
(
$
{
className
}
resources
)
;
void
update
(
$
{
className
}
resources
)
;
/
**
/
**
*
delete
*
delete
*
@
param
$
{
pkChangeColName
}
*
@
param
$
{
pkChangeColName
}
*
/
*
/
@
C
acheEvict
(
allEntries
=
true
)
//
@
C
acheEvict
(
allEntries
=
true
)
void
delete
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
void
delete
(
$
{
pkColumnType
}
$
{
pkChangeColName
})
;
}
}
\ No newline at end of file
eladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl
View file @
c4fc3da1
...
@@ -92,7 +92,6 @@ public class ${className}ServiceImpl implements ${className}Service {
...
@@ -92,7 +92,6 @@ public class ${className}ServiceImpl implements ${className}Service {
public
void
update
(
$
{
className
}
resources
)
{
public
void
update
(
$
{
className
}
resources
)
{
O
ptional
<$
{
className
}
>
optional
$
{
className
}
=
$
{
changeClassName
}
R
epository
.findById
(
resources
.get
$
{
pkCapitalColName
}())
;
O
ptional
<$
{
className
}
>
optional
$
{
className
}
=
$
{
changeClassName
}
R
epository
.findById
(
resources
.get
$
{
pkCapitalColName
}())
;
V
alidationUtil
.isNull
(
optional
$
{
className
},
"${className}"
,
"id"
,
resources
.get
$
{
pkCapitalColName
}())
;
V
alidationUtil
.isNull
(
optional
$
{
className
},
"${className}"
,
"id"
,
resources
.get
$
{
pkCapitalColName
}())
;
$
{
className
}
$
{
changeClassName
}
=
optional
$
{
className
}
.get
()
;
$
{
className
}
$
{
changeClassName
}
=
optional
$
{
className
}
.get
()
;
<#
if
columns
??>
<#
if
columns
??>
<#
list
columns
as
column
>
<#
list
columns
as
column
>
...
@@ -107,9 +106,8 @@ public class ${className}ServiceImpl implements ${className}Service {
...
@@ -107,9 +106,8 @@ public class ${className}ServiceImpl implements ${className}Service {
</#
if
>
</#
if
>
</#
list
>
</#
list
>
</#
if
>
</#
if
>
//
此处需自己修改
$
{
changeClassName
}
.copy
(
resources
)
;
resources
.set
$
{
pkCapitalColName
}(
$
{
changeClassName
}
.get
$
{
pkCapitalColName
}())
;
$
{
changeClassName
}
R
epository
.save
(
$
{
changeClassName
})
;
$
{
changeClassName
}
R
epository
.save
(
resources
)
;
}
}
@
O
verride
@
O
verride
...
...
eladmin-system/src/main/resources/template/generator/front/eForm.ftl
View file @
c4fc3da1
...
@@ -25,10 +25,6 @@ export default {
...
@@ -25,10 +25,6 @@ export default {
isAdd
:
{
isAdd
:
{
type
:
B
oolean
,
type
:
B
oolean
,
required
:
true
required
:
true
},
sup_this
:
{
type
:
O
bject
,
default
:
null
}
}
},
},
data
()
{
data
()
{
...
@@ -71,7 +67,7 @@ export default {
...
@@ -71,7 +67,7 @@ export default {
duration
:
2500
duration
:
2500
})
})
this
.loading
=
false
this
.loading
=
false
this
.
$parent
.
$parent
.
init
()
this
.
$parent
.init
()
})
.catch
(
err
=>
{
})
.catch
(
err
=>
{
this
.loading
=
false
this
.loading
=
false
console
.log
(
err
.response.data.message
)
console
.log
(
err
.response.data.message
)
...
@@ -86,7 +82,7 @@ export default {
...
@@ -86,7 +82,7 @@ export default {
duration
:
2500
duration
:
2500
})
})
this
.loading
=
false
this
.loading
=
false
this
.
sup_this
.init
()
this
.
$parent
.init
()
})
.catch
(
err
=>
{
})
.catch
(
err
=>
{
this
.loading
=
false
this
.loading
=
false
console
.log
(
err
.response.data.message
)
console
.log
(
err
.response.data.message
)
...
...
eladmin-system/src/main/resources/template/generator/front/edit.ftl
deleted
100644 → 0
View file @
375cdf4d
<
template
>
<div>
<el-button size="mini" type="primary" icon="el-icon-edit" @click="to"/>
<eForm ref="form" :sup_this="sup_this" :is-add="false"/>
</div>
</
template
>
<
script
>
import
eForm from './form'
export
default
{
components
:
{
eForm
},
props
:
{
data
:
{
type
:
O
bject
,
required
:
true
},
sup_this
:
{
type
:
O
bject
,
required
:
true
}
},
methods
:
{
to
()
{
const
_
this
=
this
.
$refs
.form
_
this
.form
=
{
<#
if
columns
??>
<#
list
columns
as
column
>
$
{
column
.changeColumnName
}:
this
.data
.$
{
column
.changeColumnName
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
}
_
this
.dialog
=
true
}
}
}
</
script
>
<
style
scoped>
div
{
display
:
inline-block
;
margin-right
:
3
px
;
}
</
style
>
eladmin-system/src/main/resources/template/generator/front/header.ftl
deleted
100644 → 0
View file @
375cdf4d
<
template
>
<div class="head-container">
<#
if
hasQuery>
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
</#
if
>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="$refs.form.dialog = true">新增</el-button>
<eForm ref="form" :is-add="true"/>
</div>
</div>
</
template
>
<
script
>
import
eForm from './form'
export
default
{
components
:
{
eForm
},
props
:
{
query
:
{
type
:
O
bject
,
required
:
true
}
},
data
()
{
return
{
<#
if
hasQuery
>
queryTypeOptions
:
[
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
{
key
:
'$
{
column
.changeColumnName
}
'
,
display_name
:
'<#
if
column
.columnComment
!=
''>$
{
column
.columnComment
}
<#
else
>$
{
column
.changeColumnName
}
</#
if
>'
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
]
</#
if
>
}
},
methods
:
{
<#
if
hasQuery
>
toQuery
()
{
this
.
$parent
.page
=
0
this
.
$parent
.init
()
}
</#
if
>
}
}
</
script
>
eladmin-system/src/main/resources/template/generator/front/index.ftl
View file @
c4fc3da1
<#-
-noinspection
ALL-->
<#-
-noinspection
ALL-->
<
template
>
<
template
>
<div class="app-container">
<div class="app-container">
<eHeader :query="query"/>
<!--工具栏-->
<div class="head-container">
<#if hasQuery>
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
</#if>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add">新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd"/>
<!--表格渲染-->
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<#if columns??>
<#if columns??>
...
@@ -21,7 +43,7 @@
...
@@ -21,7 +43,7 @@
</#if>
</#if>
<el-table-column v-if="checkPermission(['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT','$
{
upperCaseClassName
}
_DELETE'])" label="操作" width="150px" align="center">
<el-table-column v-if="checkPermission(['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT','$
{
upperCaseClassName
}
_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<template slot-scope="scope">
<e
dit
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT']"
:data="scope.row" :sup_this="sup_this
"/>
<e
l-button
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_EDIT']"
size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)
"/>
<el-popover
<el-popover
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_DELETE']"
v-permission="['ADMIN','$
{
upperCaseClassName
}
_ALL','$
{
upperCaseClassName
}
_DELETE']"
:ref="scope.row.$
{
pkChangeColName
}
"
:ref="scope.row.$
{
pkChangeColName
}
"
...
@@ -41,6 +63,7 @@
...
@@ -41,6 +63,7 @@
<el-pagination
<el-pagination
:total="total"
:total="total"
style="margin-top: 8px;"
style="margin-top: 8px;"
:current-page="page + 1"
layout="total, prev, pager, next, sizes"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@size-change="sizeChange"
@current-change="pageChange"/>
@current-change="pageChange"/>
...
@@ -54,14 +77,22 @@ import { del } from '@/api/${changeClassName}'
...
@@ -54,14 +77,22 @@ import { del } from '@/api/${changeClassName}'
<#
if
hasTimestamp>
<#
if
hasTimestamp>
import
{
parseTime
}
from '@/utils/index'
import
{
parseTime
}
from '@/utils/index'
</#
if
>
</#
if
>
import
eHeader from './module/header'
import
eForm from './form'
import
edit from './module/edit'
export
default
{
export
default
{
components
:
{
e
Header
,
edit
},
components
:
{
e
Form
},
mixins
:
[
initData
]
,
mixins
:
[
initData
]
,
data
()
{
data
()
{
return
{
return
{
delLoading
:
false
,
sup_this
:
this
delLoading
:
false
,
<#
if
hasQuery
>
queryTypeOptions
:
[
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
{
key
:
'$
{
column
.changeColumnName
}
'
,
display_name
:
'<#
if
column
.columnComment
!=
''>$
{
column
.columnComment
}
<#
else
>$
{
column
.changeColumnName
}
</#
if
>'
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
]
</#
if
>
}
}
},
},
created
()
{
created
()
{
...
@@ -91,6 +122,7 @@ export default {
...
@@ -91,6 +122,7 @@ export default {
del
(
$
{
pkChangeColName
})
.then
(
res
=>
{
del
(
$
{
pkChangeColName
})
.then
(
res
=>
{
this
.delLoading
=
false
this
.delLoading
=
false
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
this
.dleChangePage
()
this
.init
()
this
.init
()
this
.
$notify
({
this
.
$notify
({
title
:
'删除成功'
,
title
:
'删除成功'
,
...
@@ -102,6 +134,22 @@ export default {
...
@@ -102,6 +134,22 @@ export default {
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
this
.
$refs
[$
{
pkChangeColName
}
]
.doClose
()
console
.log
(
err
.response.data.message
)
console
.log
(
err
.response.data.message
)
})
})
},
add
()
{
this
.isAdd
=
true
this
.
$refs
.form.dialog
=
true
},
edit
(
data
)
{
this
.isAdd
=
false
const
_
this
=
this
.
$refs
.form
_
this
.form
=
{
<#
if
columns
??>
<#
list
columns
as
column
>
$
{
column
.changeColumnName
}:
data
.$
{
column
.changeColumnName
}
<#
if
column_has_next
>
,
</#
if
>
</#
list
>
</#
if
>
}
_
this
.dialog
=
true
}
}
}
}
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/AliPayController.java
View file @
c4fc3da1
...
@@ -34,8 +34,8 @@ public class AliPayController {
...
@@ -34,8 +34,8 @@ public class AliPayController {
private
AlipayService
alipayService
;
private
AlipayService
alipayService
;
@GetMapping
(
value
=
"/aliPay"
)
@GetMapping
(
value
=
"/aliPay"
)
public
ResponseEntity
get
(){
public
ResponseEntity
<
AlipayConfig
>
get
(){
return
new
ResponseEntity
(
alipayService
.
find
(),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
alipayService
.
find
(),
HttpStatus
.
OK
);
}
}
@Log
(
"配置支付宝"
)
@Log
(
"配置支付宝"
)
...
@@ -49,8 +49,7 @@ public class AliPayController {
...
@@ -49,8 +49,7 @@ public class AliPayController {
@Log
(
"支付宝PC网页支付"
)
@Log
(
"支付宝PC网页支付"
)
@ApiOperation
(
value
=
"PC网页支付"
)
@ApiOperation
(
value
=
"PC网页支付"
)
@PostMapping
(
value
=
"/aliPay/toPayAsPC"
)
@PostMapping
(
value
=
"/aliPay/toPayAsPC"
)
public
ResponseEntity
toPayAsPC
(
@Validated@RequestBody
TradeVo
trade
)
throws
Exception
{
public
ResponseEntity
<
String
>
toPayAsPC
(
@Validated@RequestBody
TradeVo
trade
)
throws
Exception
{
log
.
warn
(
"REST request to toPayAsPC Trade : {}"
+
trade
);
AlipayConfig
alipay
=
alipayService
.
find
();
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
String
payUrl
=
alipayService
.
toPayAsPC
(
alipay
,
trade
);
String
payUrl
=
alipayService
.
toPayAsPC
(
alipay
,
trade
);
...
@@ -60,8 +59,7 @@ public class AliPayController {
...
@@ -60,8 +59,7 @@ public class AliPayController {
@Log
(
"支付宝手机网页支付"
)
@Log
(
"支付宝手机网页支付"
)
@ApiOperation
(
value
=
"手机网页支付"
)
@ApiOperation
(
value
=
"手机网页支付"
)
@PostMapping
(
value
=
"/aliPay/toPayAsWeb"
)
@PostMapping
(
value
=
"/aliPay/toPayAsWeb"
)
public
ResponseEntity
toPayAsWeb
(
@Validated
@RequestBody
TradeVo
trade
)
throws
Exception
{
public
ResponseEntity
<
String
>
toPayAsWeb
(
@Validated
@RequestBody
TradeVo
trade
)
throws
Exception
{
log
.
warn
(
"REST request to toPayAsWeb Trade : {}"
+
trade
);
AlipayConfig
alipay
=
alipayService
.
find
();
AlipayConfig
alipay
=
alipayService
.
find
();
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
trade
.
setOutTradeNo
(
alipayUtils
.
getOrderCode
());
String
payUrl
=
alipayService
.
toPayAsWeb
(
alipay
,
trade
);
String
payUrl
=
alipayService
.
toPayAsWeb
(
alipay
,
trade
);
...
@@ -71,7 +69,7 @@ public class AliPayController {
...
@@ -71,7 +69,7 @@ public class AliPayController {
@ApiIgnore
@ApiIgnore
@GetMapping
(
"/aliPay/return"
)
@GetMapping
(
"/aliPay/return"
)
@ApiOperation
(
value
=
"支付之后跳转的链接"
)
@ApiOperation
(
value
=
"支付之后跳转的链接"
)
public
ResponseEntity
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
<
String
>
returnPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
AlipayConfig
alipay
=
alipayService
.
find
();
AlipayConfig
alipay
=
alipayService
.
find
();
response
.
setContentType
(
"text/html;charset="
+
alipay
.
getCharset
());
response
.
setContentType
(
"text/html;charset="
+
alipay
.
getCharset
());
//内容验签,防止黑客篡改参数
//内容验签,防止黑客篡改参数
...
@@ -85,12 +83,12 @@ public class AliPayController {
...
@@ -85,12 +83,12 @@ public class AliPayController {
/**
/**
* 根据业务需要返回数据,这里统一返回OK
* 根据业务需要返回数据,这里统一返回OK
*/
*/
return
new
ResponseEntity
(
"payment successful"
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>
(
"payment successful"
,
HttpStatus
.
OK
);
}
else
{
}
else
{
/**
/**
* 根据业务需要返回数据
* 根据业务需要返回数据
*/
*/
return
new
ResponseEntity
(
HttpStatus
.
BAD_REQUEST
);
return
new
ResponseEntity
<>
(
HttpStatus
.
BAD_REQUEST
);
}
}
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/PictureController.java
View file @
c4fc3da1
...
@@ -45,7 +45,7 @@ public class PictureController {
...
@@ -45,7 +45,7 @@ public class PictureController {
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
String
userName
=
SecurityUtils
.
getUsername
();
String
userName
=
SecurityUtils
.
getUsername
();
Picture
picture
=
pictureService
.
upload
(
file
,
userName
);
Picture
picture
=
pictureService
.
upload
(
file
,
userName
);
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
3
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"id"
,
picture
.
getId
());
map
.
put
(
"id"
,
picture
.
getId
());
map
.
put
(
"data"
,
new
String
[]{
picture
.
getUrl
()});
map
.
put
(
"data"
,
new
String
[]{
picture
.
getUrl
()});
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
c4fc3da1
...
@@ -56,7 +56,7 @@ public class QiniuController {
...
@@ -56,7 +56,7 @@ public class QiniuController {
@PostMapping
(
value
=
"/qiNiuContent"
)
@PostMapping
(
value
=
"/qiNiuContent"
)
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
public
ResponseEntity
upload
(
@RequestParam
MultipartFile
file
){
QiniuContent
qiniuContent
=
qiNiuService
.
upload
(
file
,
qiNiuService
.
find
());
QiniuContent
qiniuContent
=
qiNiuService
.
upload
(
file
,
qiNiuService
.
find
());
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
3
);
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"errno"
,
0
);
map
.
put
(
"errno"
,
0
);
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
...
@@ -84,7 +84,7 @@ public class QiniuController {
...
@@ -84,7 +84,7 @@ public class QiniuController {
@Log
(
"下载文件"
)
@Log
(
"下载文件"
)
@GetMapping
(
value
=
"/qiNiuContent/download/{id}"
)
@GetMapping
(
value
=
"/qiNiuContent/download/{id}"
)
public
ResponseEntity
download
(
@PathVariable
Long
id
){
public
ResponseEntity
download
(
@PathVariable
Long
id
){
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
(
1
);
map
.
put
(
"url"
,
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()));
map
.
put
(
"url"
,
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()));
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/service/QiNiuService.java
View file @
c4fc3da1
...
@@ -45,6 +45,7 @@ public interface QiNiuService {
...
@@ -45,6 +45,7 @@ public interface QiNiuService {
* 上传文件
* 上传文件
* @param file
* @param file
* @param qiniuConfig
* @param qiniuConfig
* @return
*/
*/
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
QiniuContent
upload
(
MultipartFile
file
,
QiniuConfig
qiniuConfig
);
QiniuContent
upload
(
MultipartFile
file
,
QiniuConfig
qiniuConfig
);
...
@@ -84,7 +85,7 @@ public interface QiNiuService {
...
@@ -84,7 +85,7 @@ public interface QiNiuService {
/**
/**
* 删除文件
* 删除文件
* @param ids
* @param ids
* @
return
* @
param config
*/
*/
@CacheEvict
(
allEntries
=
true
)
@CacheEvict
(
allEntries
=
true
)
void
deleteAll
(
Long
[]
ids
,
QiniuConfig
config
);
void
deleteAll
(
Long
[]
ids
,
QiniuConfig
config
);
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java
View file @
c4fc3da1
...
@@ -83,7 +83,8 @@ public class EmailServiceImpl implements EmailService {
...
@@ -83,7 +83,8 @@ public class EmailServiceImpl implements EmailService {
.
setTitle
(
emailVo
.
getSubject
())
.
setTitle
(
emailVo
.
getSubject
())
.
setContent
(
content
)
.
setContent
(
content
)
.
setHtml
(
true
)
.
setHtml
(
true
)
.
setUseGlobalSession
(
false
)
//关闭session
//关闭session
.
setUseGlobalSession
(
false
)
.
send
();
.
send
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
BadRequestException
(
e
.
getMessage
());
throw
new
BadRequestException
(
e
.
getMessage
());
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/PictureServiceImpl.java
View file @
c4fc3da1
...
@@ -49,7 +49,7 @@ public class PictureServiceImpl implements PictureService {
...
@@ -49,7 +49,7 @@ public class PictureServiceImpl implements PictureService {
public
Picture
upload
(
MultipartFile
multipartFile
,
String
username
)
{
public
Picture
upload
(
MultipartFile
multipartFile
,
String
username
)
{
File
file
=
FileUtil
.
toFile
(
multipartFile
);
File
file
=
FileUtil
.
toFile
(
multipartFile
);
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<>(
1
);
paramMap
.
put
(
"smfile"
,
file
);
paramMap
.
put
(
"smfile"
,
file
);
String
result
=
HttpUtil
.
post
(
ElAdminConstant
.
Url
.
SM_MS_URL
,
paramMap
);
String
result
=
HttpUtil
.
post
(
ElAdminConstant
.
Url
.
SM_MS_URL
,
paramMap
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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