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
a481b16b
Commit
a481b16b
authored
Sep 10, 2019
by
dqjdda
Browse files
update
parent
8053570a
Changes
10
Hide whitespace changes
Inline
Side-by-side
eladmin-common/pom.xml
View file @
a481b16b
...
@@ -10,5 +10,6 @@
...
@@ -10,5 +10,6 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-common
</artifactId>
<artifactId>
eladmin-common
</artifactId>
<name>
公共模块
</name>
</project>
</project>
\ No newline at end of file
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
View file @
a481b16b
package
me.zhengjie.utils
;
package
me.zhengjie.utils
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.io.*
;
...
@@ -187,7 +186,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -187,7 +186,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
byte
[]
buffer
=
new
byte
[(
int
)
file
.
length
()];
byte
[]
buffer
=
new
byte
[(
int
)
file
.
length
()];
inputFile
.
read
(
buffer
);
inputFile
.
read
(
buffer
);
inputFile
.
close
();
inputFile
.
close
();
base64
=
new
B
ASE64Encoder
().
encode
(
buffer
);
base64
=
new
B
ase64
().
encode
(
buffer
);
String
encoded
=
base64
.
replaceAll
(
"[\\s*\t\n\r]"
,
""
);
String
encoded
=
base64
.
replaceAll
(
"[\\s*\t\n\r]"
,
""
);
return
encoded
;
return
encoded
;
}
}
...
...
eladmin-common/src/main/java/me/zhengjie/utils/TranslatorUtil.java
0 → 100644
View file @
a481b16b
package
me.zhengjie.utils
;
import
cn.hutool.json.JSONArray
;
import
lombok.var
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLEncoder
;
public
class
TranslatorUtil
{
public
static
String
translate
(
String
word
){
try
{
String
url
=
"https://translate.googleapis.com/translate_a/single?"
+
"client=gtx&"
+
"sl=en"
+
"&tl=zh-CN"
+
"&dt=t&q="
+
URLEncoder
.
encode
(
word
,
"UTF-8"
);
URL
obj
=
new
URL
(
url
);
HttpURLConnection
con
=
(
HttpURLConnection
)
obj
.
openConnection
();
con
.
setRequestProperty
(
"User-Agent"
,
"Mozilla/5.0"
);
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
con
.
getInputStream
()));
String
inputLine
;
StringBuffer
response
=
new
StringBuffer
();
while
((
inputLine
=
in
.
readLine
())
!=
null
)
{
response
.
append
(
inputLine
);
}
in
.
close
();
return
parseResult
(
response
.
toString
());
}
catch
(
Exception
e
){
return
word
;
}
}
private
static
String
parseResult
(
String
inputJson
)
throws
Exception
{
JSONArray
jsonArray
=
new
JSONArray
(
inputJson
);
JSONArray
jsonArray2
=
(
JSONArray
)
jsonArray
.
get
(
0
);
String
result
=
""
;
for
(
var
i
=
0
;
i
<
jsonArray2
.
size
();
i
++){
result
+=
((
JSONArray
)
jsonArray2
.
get
(
i
)).
get
(
0
).
toString
();
}
return
result
;
}
}
eladmin-generator/pom.xml
View file @
a481b16b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-generator
</artifactId>
<artifactId>
eladmin-generator
</artifactId>
<name>
代码生成模块
</name>
<properties>
<properties>
<configuration.version>
1.9
</configuration.version>
<configuration.version>
1.9
</configuration.version>
...
...
eladmin-logging/pom.xml
View file @
a481b16b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-logging
</artifactId>
<artifactId>
eladmin-logging
</artifactId>
<name>
日志模块
</name>
<dependencies>
<dependencies>
<dependency>
<dependency>
...
...
eladmin-system/pom.xml
View file @
a481b16b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-system
</artifactId>
<artifactId>
eladmin-system
</artifactId>
<name>
核心模块
</name>
<properties>
<properties>
<jjwt.version>
0.9.1
</jjwt.version>
<jjwt.version>
0.9.1
</jjwt.version>
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
a481b16b
...
@@ -4,7 +4,6 @@ import me.zhengjie.aop.log.Log;
...
@@ -4,7 +4,6 @@ import me.zhengjie.aop.log.Log;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictDTO
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
...
eladmin-tools/pom.xml
View file @
a481b16b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
eladmin-tools
</artifactId>
<artifactId>
eladmin-tools
</artifactId>
<name>
工具模块
</name>
<properties>
<properties>
<mail.version>
1.4.7
</mail.version>
<mail.version>
1.4.7
</mail.version>
...
...
eladmin-tools/src/main/java/me/zhengjie/service/impl/PictureServiceImpl.java
View file @
a481b16b
...
@@ -37,7 +37,7 @@ public class PictureServiceImpl implements PictureService {
...
@@ -37,7 +37,7 @@ public class PictureServiceImpl implements PictureService {
public
static
final
String
CODE
=
"code"
;
public
static
final
String
CODE
=
"code"
;
public
static
final
String
MSG
=
"m
sg
"
;
public
static
final
String
MSG
=
"m
essage
"
;
@Override
@Override
public
Object
queryAll
(
PictureQueryCriteria
criteria
,
Pageable
pageable
){
public
Object
queryAll
(
PictureQueryCriteria
criteria
,
Pageable
pageable
){
...
@@ -56,7 +56,7 @@ public class PictureServiceImpl implements PictureService {
...
@@ -56,7 +56,7 @@ public class PictureServiceImpl implements PictureService {
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
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
(
TranslatorUtil
.
translate
(
jsonObject
.
get
(
MSG
).
toString
())
)
;
}
}
//转成实体类
//转成实体类
picture
=
JSON
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
(),
Picture
.
class
);
picture
=
JSON
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
(),
Picture
.
class
);
...
...
pom.xml
View file @
a481b16b
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<module>
eladmin-generator
</module>
<module>
eladmin-generator
</module>
</modules>
</modules>
<name>
el-admin
</name>
<name>
EL-ADMIN后台管理系统
</name>
<url>
http://auauz.net
</url>
<url>
http://auauz.net
</url>
<parent>
<parent>
...
...
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