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
9f43851e
Commit
9f43851e
authored
Apr 11, 2019
by
zhengjie
Browse files
1.7版本发布,详情查看版本说明
parent
1402e584
Changes
89
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/resources/config/application.yml
View file @
9f43851e
...
...
@@ -41,7 +41,7 @@ spring:
#七牛云
qiniu
:
# 文件大小 /M
max-size
:
5
max-size
:
1
5
#验证码有效时间/分钟
code
:
...
...
eladmin-system/src/main/resources/template/generator/admin/QueryService.ftl
View file @
9f43851e
...
...
@@ -67,24 +67,24 @@ public class ${className}QueryService {
L
ist
<
P
redicate
>
list
=
new
A
rrayList
<
P
redicate
>
()
;
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
if
(
!
O
bjectUtils
.isEmpty
(
$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}())){
<#
if
column
.columnQuery
=
'
1
'>
/
**
*
模糊
*
/
list
.add
(
cb
.like
(
root
.get
(
"${column.columnName}"
)
.as
(
$
{
column
.columnType
}
.class
),
"%"
+$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}()
+
"%"
))
;
</#
if
>
<#
if
column
.columnQuery
=
'
2
'>
/
**
*
精确
*
/
list
.add
(
cb
.equal
(
root
.get
(
"${column.columnName}"
)
.as
(
$
{
column
.columnType
}
.class
),
$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}()))
;
</#
if
>
}
</#
list
>
</#
if
>
<#
if
queryColumns
??>
<#
list
queryColumns
as
column
>
if
(
!
O
bjectUtils
.isEmpty
(
$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}())){
<#
if
column
.columnQuery
=
'
1
'>
/
**
*
模糊
*
/
list
.add
(
cb
.like
(
root
.get
(
"${column.columnName}"
)
.as
(
$
{
column
.columnType
}
.class
),
"%"
+$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}()
+
"%"
))
;
</#
if
>
<#
if
column
.columnQuery
=
'
2
'>
/
**
*
精确
*
/
list
.add
(
cb
.equal
(
root
.get
(
"${column.columnName}"
)
.as
(
$
{
column
.columnType
}
.class
),
$
{
changeClassName
}
.get
$
{
column
.capitalColumnName
}()))
;
</#
if
>
}
</#
list
>
</#
if
>
P
redicate
[]
p
=
new
P
redicate
[
list
.size
()
];
return
cb
.and
(
list
.toArray
(
p
))
;
}
...
...
eladmin-system/src/main/resources/template/generator/front/index.ftl
View file @
9f43851e
...
...
@@ -3,7 +3,7 @@
<div class="app-container">
<eHeader :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small"
border
style="width: 100%;">
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<#if columns??>
<#list columns as column>
<#if column.columnShow = 'true'>
...
...
eladmin-tools/src/main/java/me/zhengjie/rest/QiniuController.java
View file @
9f43851e
...
...
@@ -8,11 +8,15 @@ import me.zhengjie.service.QiNiuService;
import
me.zhengjie.service.query.QiNiuQueryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.nio.charset.Charset
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -87,7 +91,9 @@ public class QiniuController {
@Log
(
"下载文件"
)
@GetMapping
(
value
=
"/qiNiuContent/download/{id}"
)
public
ResponseEntity
download
(
@PathVariable
Long
id
){
return
new
ResponseEntity
(
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()),
HttpStatus
.
OK
);
Map
map
=
new
HashMap
();
map
.
put
(
"url"
,
qiNiuService
.
download
(
qiNiuService
.
findByContentId
(
id
),
qiNiuService
.
find
()));
return
new
ResponseEntity
(
map
,
HttpStatus
.
OK
);
}
/**
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/AlipayServiceImpl.java
View file @
9f43851e
...
...
@@ -39,9 +39,6 @@ public class AlipayServiceImpl implements AlipayService {
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
alipay
.
getGatewayUrl
(),
alipay
.
getAppID
(),
alipay
.
getPrivateKey
(),
alipay
.
getFormat
(),
alipay
.
getCharset
(),
alipay
.
getPublicKey
(),
alipay
.
getSignType
());
double
money
=
Double
.
parseDouble
(
trade
.
getTotalAmount
());
if
(
money
<=
0
||
money
>=
5000
){
throw
new
BadRequestException
(
"测试金额过大"
);
}
/**
* 创建API对应的request(电脑网页版)
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/PictureServiceImpl.java
View file @
9f43851e
...
...
@@ -58,7 +58,7 @@ public class PictureServiceImpl implements PictureService {
picture
=
JSON
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
(),
Picture
.
class
);
picture
.
setSize
(
FileUtil
.
getSize
(
Integer
.
valueOf
(
picture
.
getSize
())));
picture
.
setUsername
(
username
);
picture
.
setFilename
(
FileUtil
.
getFileNameNoEx
(
multipartFile
.
getOriginalFilename
())+
FileUtil
.
getExtensionName
(
multipartFile
.
getOriginalFilename
()));
picture
.
setFilename
(
FileUtil
.
getFileNameNoEx
(
multipartFile
.
getOriginalFilename
())+
"."
+
FileUtil
.
getExtensionName
(
multipartFile
.
getOriginalFilename
()));
pictureRepository
.
save
(
picture
);
//删除临时文件
FileUtil
.
deleteFile
(
file
);
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java
View file @
9f43851e
...
...
@@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.time.LocalDate
;
import
java.util.Optional
;
/**
...
...
@@ -84,7 +86,11 @@ public class QiNiuServiceImpl implements QiNiuService {
Auth
auth
=
Auth
.
create
(
qiniuConfig
.
getAccessKey
(),
qiniuConfig
.
getSecretKey
());
String
upToken
=
auth
.
uploadToken
(
qiniuConfig
.
getBucket
());
try
{
Response
response
=
uploadManager
.
put
(
file
.
getBytes
(),
QiNiuUtil
.
getKey
(
file
.
getOriginalFilename
()),
upToken
);
String
key
=
file
.
getOriginalFilename
();
if
(
qiniuContentRepository
.
findByKey
(
key
)
!=
null
)
{
key
=
QiNiuUtil
.
getKey
(
key
);
}
Response
response
=
uploadManager
.
put
(
file
.
getBytes
(),
key
,
upToken
);
//解析上传成功的结果
DefaultPutRet
putRet
=
new
Gson
().
fromJson
(
response
.
bodyString
(),
DefaultPutRet
.
class
);
//存入数据库
...
...
@@ -134,8 +140,7 @@ public class QiNiuServiceImpl implements QiNiuService {
bucketManager
.
delete
(
content
.
getBucket
(),
content
.
getKey
());
qiniuContentRepository
.
delete
(
content
);
}
catch
(
QiniuException
ex
)
{
System
.
err
.
println
(
ex
.
code
());
System
.
err
.
println
(
ex
.
response
.
toString
());
qiniuContentRepository
.
delete
(
content
);
}
}
...
...
eladmin-tools/src/main/java/me/zhengjie/util/QiNiuUtil.java
View file @
9f43851e
...
...
@@ -52,6 +52,7 @@ public class QiNiuUtil {
StringBuffer
key
=
new
StringBuffer
(
FileUtil
.
getFileNameNoEx
(
file
));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
Date
date
=
new
Date
();
key
.
append
(
"-"
);
key
.
append
(
sdf
.
format
(
date
));
key
.
append
(
"."
);
key
.
append
(
FileUtil
.
getExtensionName
(
file
));
...
...
pom.xml
View file @
9f43851e
...
...
@@ -48,6 +48,10 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
...
@@ -97,6 +101,12 @@
<artifactId>
commons-lang3
</artifactId>
</dependency>
<dependency>
<groupId>
commons-beanutils
</groupId>
<artifactId>
commons-beanutils
</artifactId>
<version>
1.9.3
</version>
</dependency>
<!--监控sql日志-->
<dependency>
<groupId>
org.bgee.log4jdbc-log4j2
</groupId>
...
...
Prev
1
2
3
4
5
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