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
4e39694e
"jetbrains:/idea/checkout/git" did not exist on "a1e4de537985d8f98fbe4bc11adc78a2a9d80f76"
Commit
4e39694e
authored
Feb 28, 2019
by
zhengjie
Browse files
v1.6 版本发布 ,详情查看版本说明
parent
f63407fd
Changes
46
Show whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/RoleMapper.java
View file @
4e39694e
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
...
@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
* @author jie
* @author jie
* @date 2018-11-23
* @date 2018-11-23
*/
*/
@Mapper
(
componentModel
=
"spring"
,
uses
=
{
PermissionMapper
.
class
},
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
@Mapper
(
componentModel
=
"spring"
,
uses
=
{
PermissionMapper
.
class
,
MenuMapper
.
class
},
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
RoleMapper
extends
EntityMapper
<
RoleDTO
,
Role
>
{
public
interface
RoleMapper
extends
EntityMapper
<
RoleDTO
,
Role
>
{
}
}
eladmin-system/src/main/resources/template/email/email.ftl
View file @
4e39694e
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
maigin-bottom: 10px;
maigin-bottom: 10px;
font-size: 14px;
font-size: 14px;
color: #555;">
color: #555;">
<p style="line-height: 12px;">扣扣群:891137268</p>
<p style="line-height: 12px;">Github:<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">https://github.com/elunez/eladmin</a></p>
<p style="line-height: 12px;">Github:<a hover="color: #DA251D;" style="color: #999;" href="https://github.com/elunez/eladmin" target="_blank">https://github.com/elunez/eladmin</a></p>
</div>
</div>
<div class="foot-hr hr" style="margin: 0 auto;
<div class="foot-hr hr" style="margin: 0 auto;
...
...
eladmin-system/src/main/resources/template/generator/admin/Controller.ftl
View file @
4e39694e
...
@@ -30,12 +30,6 @@ public class ${className}Controller {
...
@@ -30,12 +30,6 @@ public class ${className}Controller {
private
static
final
S
tring
ENTITY
_
NAME
=
"${changeClassName}"
;
private
static
final
S
tring
ENTITY
_
NAME
=
"${changeClassName}"
;
@
G
etMapping
(
value
=
"/${changeClassName}/{id}"
)
@
P
reAuthorize
(
"hasAnyRole('ADMIN')"
)
public
R
esponseEntity
get
$
{
className
}(
@
P
athVariable
$
{
pkColumnType
}
id
){
return
new
R
esponseEntity
(
$
{
changeClassName
}
S
ervice
.findById
(
id
),
H
ttpStatus
.OK
)
;
}
@
L
og
(
"查询${className}"
)
@
L
og
(
"查询${className}"
)
@
G
etMapping
(
value
=
"/${changeClassName}"
)
@
G
etMapping
(
value
=
"/${changeClassName}"
)
@
P
reAuthorize
(
"hasAnyRole('ADMIN')"
)
@
P
reAuthorize
(
"hasAnyRole('ADMIN')"
)
...
...
eladmin-tools/src/main/java/me/zhengjie/config/MultipartConfig.java
View file @
4e39694e
...
@@ -3,7 +3,6 @@ package me.zhengjie.config;
...
@@ -3,7 +3,6 @@ package me.zhengjie.config;
import
org.springframework.boot.web.servlet.MultipartConfigFactory
;
import
org.springframework.boot.web.servlet.MultipartConfigFactory
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
javax.servlet.MultipartConfigElement
;
import
javax.servlet.MultipartConfigElement
;
import
java.io.File
;
import
java.io.File
;
...
@@ -20,7 +19,7 @@ public class MultipartConfig {
...
@@ -20,7 +19,7 @@ public class MultipartConfig {
@Bean
@Bean
MultipartConfigElement
multipartConfigElement
()
{
MultipartConfigElement
multipartConfigElement
()
{
MultipartConfigFactory
factory
=
new
MultipartConfigFactory
();
MultipartConfigFactory
factory
=
new
MultipartConfigFactory
();
String
location
=
System
.
getProperty
(
"user.
dir
"
)
+
"
target
/file/tmp"
;
String
location
=
System
.
getProperty
(
"user.
home
"
)
+
"
/.eladmin
/file/tmp"
;
File
tmpFile
=
new
File
(
location
);
File
tmpFile
=
new
File
(
location
);
if
(!
tmpFile
.
exists
())
{
if
(!
tmpFile
.
exists
())
{
tmpFile
.
mkdirs
();
tmpFile
.
mkdirs
();
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
4e39694e
...
@@ -60,8 +60,8 @@ public class QiniuController {
...
@@ -60,8 +60,8 @@ public class QiniuController {
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
();
map
.
put
(
"errno"
,
0
);
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"id"
,
qiniuContent
.
getId
());
map
.
put
(
"errno"
,
0
);
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
map
.
put
(
"data"
,
new
String
[]{
qiniuContent
.
getUrl
()});
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/PictureServiceImpl.java
View file @
4e39694e
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
...
@@ -12,17 +13,12 @@ import me.zhengjie.utils.ElAdminConstant;
...
@@ -12,17 +13,12 @@ import me.zhengjie.utils.ElAdminConstant;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.FileUtil
;
import
me.zhengjie.utils.ValidationUtil
;
import
me.zhengjie.utils.ValidationUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.File
;
import
java.util.
Arrays
;
import
java.util.
HashMap
;
import
java.util.Optional
;
import
java.util.Optional
;
/**
/**
...
@@ -47,22 +43,13 @@ public class PictureServiceImpl implements PictureService {
...
@@ -47,22 +43,13 @@ public class PictureServiceImpl implements PictureService {
@Transactional
(
rollbackFor
=
Throwable
.
class
)
@Transactional
(
rollbackFor
=
Throwable
.
class
)
public
Picture
upload
(
MultipartFile
multipartFile
,
String
username
)
{
public
Picture
upload
(
MultipartFile
multipartFile
,
String
username
)
{
File
file
=
FileUtil
.
toFile
(
multipartFile
);
File
file
=
FileUtil
.
toFile
(
multipartFile
);
//将参数合成一个请求
RestTemplate
rest
=
new
RestTemplate
();
FileSystemResource
resource
=
new
FileSystemResource
(
file
);
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
MultiValueMap
<
String
,
Object
>
param
=
new
LinkedMultiValueMap
<>();
param
.
add
(
"smfile"
,
resource
);
//设置头部,必须
paramMap
.
put
(
"smfile"
,
file
);
HttpHeaders
headers
=
new
HttpHeaders
();
String
result
=
HttpUtil
.
post
(
ElAdminConstant
.
Url
.
SM_MS_URL
,
paramMap
);
headers
.
setAccept
(
Arrays
.
asList
(
MediaType
.
APPLICATION_JSON
));
headers
.
add
(
"user-agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
httpEntity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
param
,
headers
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
ResponseEntity
<
String
>
responseEntity
=
rest
.
exchange
(
ElAdminConstant
.
Url
.
SM_MS_URL
,
HttpMethod
.
POST
,
httpEntity
,
String
.
class
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
responseEntity
.
getBody
());
Picture
picture
=
null
;
Picture
picture
=
null
;
if
(!
jsonObject
.
get
(
CODE
).
toString
().
equals
(
SUCCESS
)){
if
(!
jsonObject
.
get
(
CODE
).
toString
().
equals
(
SUCCESS
)){
throw
new
BadRequestException
(
jsonObject
.
get
(
MSG
).
toString
());
throw
new
BadRequestException
(
jsonObject
.
get
(
MSG
).
toString
());
...
@@ -76,6 +63,7 @@ public class PictureServiceImpl implements PictureService {
...
@@ -76,6 +63,7 @@ public class PictureServiceImpl implements PictureService {
//删除临时文件
//删除临时文件
FileUtil
.
deleteFile
(
file
);
FileUtil
.
deleteFile
(
file
);
return
picture
;
return
picture
;
}
}
@Override
@Override
...
@@ -88,13 +76,9 @@ public class PictureServiceImpl implements PictureService {
...
@@ -88,13 +76,9 @@ public class PictureServiceImpl implements PictureService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Picture
picture
)
{
public
void
delete
(
Picture
picture
)
{
RestTemplate
rest
=
new
RestTemplate
();
try
{
try
{
ResponseEntity
<
String
>
str
=
rest
.
getForEntity
(
picture
.
getDelete
(),
String
.
class
);
String
result
=
HttpUtil
.
get
(
picture
.
getDelete
());
if
(
str
.
getStatusCode
().
is2xxSuccessful
()){
pictureRepository
.
delete
(
picture
);
pictureRepository
.
delete
(
picture
);
}
//如果删除的地址出错,直接删除数据库数据
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
pictureRepository
.
delete
(
picture
);
pictureRepository
.
delete
(
picture
);
}
}
...
...
Prev
1
2
3
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