Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
admin
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
曲欣亮
admin
Commits
6c948840
Commit
6c948840
authored
Aug 06, 2018
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传
parent
5cc0dd71
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
36 deletions
+40
-36
OSSFileController.java
...in/java/com/egolm/admin/controller/OSSFileController.java
+33
-32
SystemCtlService.java
src/main/java/com/egolm/admin/service/SystemCtlService.java
+1
-1
SystemCtlServiceImpl.java
...va/com/egolm/admin/service/impl/SystemCtlServiceImpl.java
+6
-3
No files found.
src/main/java/com/egolm/admin/controller/OSSFileController.java
View file @
6c948840
...
@@ -3,6 +3,7 @@ package com.egolm.admin.controller;
...
@@ -3,6 +3,7 @@ package com.egolm.admin.controller;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -28,6 +29,7 @@ import com.egolm.admin.util.AdminContstrant;
...
@@ -28,6 +29,7 @@ import com.egolm.admin.util.AdminContstrant;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.HttpUtil
;
import
com.egolm.common.HttpUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -73,15 +75,14 @@ public class OSSFileController {
...
@@ -73,15 +75,14 @@ public class OSSFileController {
})
})
@RequestMapping
(
value
=
"/upload"
,
method
=
RequestMethod
.
POST
)
//
@RequestMapping
(
value
=
"/upload"
,
method
=
RequestMethod
.
POST
)
//
public
String
upload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
)
throws
IOException
{
public
String
upload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
)
throws
IOException
{
List
<
String
>
codeList
=
new
ArrayList
<
String
>();
String
[]
codes
=
new
String
[
2
];
codeList
.
add
(
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
);
codes
[
0
]
=
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
;
codeList
.
add
(
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
);
codes
[
1
]
=
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
;
System
.
out
.
println
(
"-----"
+
StringUtil
.
join
(
","
,
codeList
));
List
<
Map
<
String
,
Object
>>
listCtl
=
systemCtlService
.
getTSystemCtrlByCode
(
codeList
);
List
<
TSystemCtrl
>
listCtl
=
systemCtlService
.
getTSystemCtrlByCode
(
codes
);
if
(
listCtl
.
isEmpty
()
||
listCtl
.
size
()
!=
2
)
{
if
(
listCtl
.
isEmpty
()
||
listCtl
.
size
()
!=
2
)
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"请检查"
+
codes
[
0
]+
"和"
+
codes
[
1
]+
"
参数是否配置"
).
toJson
();
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"请检查"
+
StringUtil
.
join
(
","
,
codeList
)+
"
参数是否配置"
).
toJson
();
}
}
String
ossUrl
=
""
;
//上传的URL
String
ossUrl
=
""
;
//上传的URL
...
@@ -92,17 +93,17 @@ public class OSSFileController {
...
@@ -92,17 +93,17 @@ public class OSSFileController {
String
secret
=
""
;
// 自建OSS平台分配的 密钥
String
secret
=
""
;
// 自建OSS平台分配的 密钥
for
(
TSystemCtrl
ctrl
:
listCtl
)
{
for
(
Map
<
String
,
Object
>
ctrlMap
:
listCtl
)
{
String
code
=
ctrl
.
getsCode
()
;
String
code
=
ctrl
Map
.
get
(
"sCode"
)+
""
;
if
(
code
.
equals
(
codes
[
0
]
))
{
if
(
code
.
equals
(
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
))
{
ossUrl
=
ctrl
.
getsValue1
();
ossUrl
=
ctrl
Map
.
get
(
"sValue1"
)+
""
;
//ctrl
.getsValue1();
httpUrl
=
ctrl
.
getsValue2
();
httpUrl
=
ctrl
Map
.
get
(
"sValue2"
)+
""
;
//ctrl
.getsValue2();
documentID
=
ctrl
.
getsValue3
();
documentID
=
ctrl
Map
.
get
(
"sValue3"
)+
""
;
// ctrl
.getsValue3();
dir
=
ctrl
.
getsValue4
();
dir
=
ctrl
Map
.
get
(
"sValue4"
)+
""
;
// ctrl
.getsValue4();
}
}
if
(
code
.
equals
(
codes
[
1
]
))
{
if
(
code
.
equals
(
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
))
{
appID
=
ctrl
.
getsValue1
();
appID
=
ctrl
Map
.
get
(
"sValue1"
)+
""
;
//ctrl
.getsValue1();
secret
=
ctrl
.
getsValue2
();
secret
=
ctrlMap
.
get
(
"sValue2"
)+
""
;
//
ctrl.getsValue2();
}
}
}
}
...
@@ -175,14 +176,14 @@ public class OSSFileController {
...
@@ -175,14 +176,14 @@ public class OSSFileController {
public
String
testUpload
(
HttpServletRequest
request
)
throws
IOException
{
public
String
testUpload
(
HttpServletRequest
request
)
throws
IOException
{
String
uFilePath
=
request
.
getParameter
(
"uFilePath"
);
String
uFilePath
=
request
.
getParameter
(
"uFilePath"
);
String
[]
codes
=
new
String
[
2
]
;
List
<
String
>
codeList
=
new
ArrayList
<
String
>()
;
code
s
[
0
]
=
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
;
code
List
.
add
(
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
)
;
code
s
[
1
]
=
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
;
code
List
.
add
(
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
)
;
List
<
TSystemCtrl
>
listCtl
=
systemCtlService
.
getTSystemCtrlByCode
(
codes
);
List
<
Map
<
String
,
Object
>>
listCtl
=
systemCtlService
.
getTSystemCtrlByCode
(
codeList
);
if
(
listCtl
.
isEmpty
()
||
listCtl
.
size
()
!=
2
)
{
if
(
listCtl
.
isEmpty
()
||
listCtl
.
size
()
!=
2
)
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"请检查"
+
codes
[
0
]+
"和"
+
codes
[
1
]+
"
参数是否配置"
).
toJson
();
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"请检查"
+
StringUtil
.
join
(
","
,
codeList
)+
"
参数是否配置"
).
toJson
();
}
}
String
ossUrl
=
""
;
//上传的URL
String
ossUrl
=
""
;
//上传的URL
...
@@ -193,17 +194,17 @@ public class OSSFileController {
...
@@ -193,17 +194,17 @@ public class OSSFileController {
String
secret
=
""
;
// 自建OSS平台分配的 密钥
String
secret
=
""
;
// 自建OSS平台分配的 密钥
for
(
TSystemCtrl
ctrl
:
listCtl
)
{
for
(
Map
<
String
,
Object
>
ctrlMap
:
listCtl
)
{
String
code
=
ctrl
.
getsCode
()
;
String
code
=
ctrl
Map
.
get
(
"sCode"
)+
""
;
if
(
code
.
equals
(
codes
[
0
]
))
{
if
(
code
.
equals
(
AdminContstrant
.
OSS_UPLOAD_CONFIG_KEY
))
{
ossUrl
=
ctrl
.
getsValue1
();
ossUrl
=
ctrl
Map
.
get
(
"sValue1"
)+
""
;
//ctrl
.getsValue1();
httpUrl
=
ctrl
.
getsValue2
();
httpUrl
=
ctrl
Map
.
get
(
"sValue2"
)+
""
;
//ctrl
.getsValue2();
documentID
=
ctrl
.
getsValue3
();
documentID
=
ctrl
Map
.
get
(
"sValue3"
)+
""
;
// ctrl
.getsValue3();
dir
=
ctrl
.
getsValue4
();
dir
=
ctrl
Map
.
get
(
"sValue4"
)+
""
;
// ctrl
.getsValue4();
}
}
if
(
code
.
equals
(
codes
[
1
]
))
{
if
(
code
.
equals
(
AdminContstrant
.
OSS_UPLOAD_SECRET_KEY
))
{
appID
=
ctrl
.
getsValue1
();
appID
=
ctrl
Map
.
get
(
"sValue1"
)+
""
;
//ctrl
.getsValue1();
secret
=
ctrl
.
getsValue2
();
secret
=
ctrlMap
.
get
(
"sValue2"
)+
""
;
//
ctrl.getsValue2();
}
}
}
}
...
...
src/main/java/com/egolm/admin/service/SystemCtlService.java
View file @
6c948840
...
@@ -7,5 +7,5 @@ import com.egolm.admin.pojo.TSystemCtrl;
...
@@ -7,5 +7,5 @@ import com.egolm.admin.pojo.TSystemCtrl;
public
interface
SystemCtlService
{
public
interface
SystemCtlService
{
public
List
<
TSystemCtrl
>
getTSystemCtrlByCode
(
String
[]
codes
);
public
List
<
Map
<
String
,
Object
>>
getTSystemCtrlByCode
(
List
<
String
>
codeList
);
}
}
src/main/java/com/egolm/admin/service/impl/SystemCtlServiceImpl.java
View file @
6c948840
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import
com.egolm.admin.pojo.TSystemCtrl
;
import
com.egolm.admin.pojo.TSystemCtrl
;
import
com.egolm.admin.service.SystemCtlService
;
import
com.egolm.admin.service.SystemCtlService
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
/**
/**
...
@@ -26,9 +27,11 @@ public class SystemCtlServiceImpl implements SystemCtlService {
...
@@ -26,9 +27,11 @@ public class SystemCtlServiceImpl implements SystemCtlService {
private
JdbcTemplate
jdbcTemplate
;
private
JdbcTemplate
jdbcTemplate
;
@Override
@Override
public
List
<
TSystemCtrl
>
getTSystemCtrlByCode
(
String
[]
codes
)
{
public
List
<
Map
<
String
,
Object
>>
getTSystemCtrlByCode
(
List
<
String
>
codeList
)
{
String
sql
=
"select * from tSystemCtrl where sCode in ? and nTag&1=0"
;
String
orgStr
=
StringUtil
.
join
(
"','"
,
"'"
,
"'"
,
codeList
);
return
jdbcTemplate
.
queryForList
(
sql
,
TSystemCtrl
.
class
,
codes
);
System
.
out
.
println
(
orgStr
);
String
sql
=
"select * from tSystemCtrl where sCode in ("
+
orgStr
+
") and nTag&1=0"
;
return
jdbcTemplate
.
queryForList
(
sql
);
}
}
}
}
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