Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
entrance_api
Project
Project
Details
Activity
Releases
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
王琮
entrance_api
Commits
8feb14c6
Commit
8feb14c6
authored
Mar 15, 2023
by
gaoyingwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 上传文件
parent
3d7444ac
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
15 deletions
+39
-15
OssInfoController.java
...org/rcisoft/sys/ossinfo/controller/OssInfoController.java
+2
-1
OssInfoService.java
.../java/org/rcisoft/sys/ossinfo/service/OssInfoService.java
+2
-1
OssInfoServiceImpl.java
.../rcisoft/sys/ossinfo/service/impl/OssInfoServiceImpl.java
+2
-1
OssINfoUtil.java
src/main/java/org/rcisoft/sys/ossinfo/util/OssINfoUtil.java
+32
-12
SysUserRepositorys.xml
src/main/resources/mapper/SysUserRepositorys.xml
+1
-0
No files found.
src/main/java/org/rcisoft/sys/ossinfo/controller/OssInfoController.java
View file @
8feb14c6
...
@@ -26,6 +26,7 @@ import org.rcisoft.sys.ossinfo.entity.OssInfo;
...
@@ -26,6 +26,7 @@ import org.rcisoft.sys.ossinfo.entity.OssInfo;
import
org.rcisoft.sys.ossinfo.service.OssInfoService
;
import
org.rcisoft.sys.ossinfo.service.OssInfoService
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -138,7 +139,7 @@ public class OssInfoController extends CyPaginationController<OssInfo> {
...
@@ -138,7 +139,7 @@ public class OssInfoController extends CyPaginationController<OssInfo> {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"file"
,
value
=
"文件"
,
required
=
true
,
dataType
=
"file"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"file"
,
value
=
"文件"
,
required
=
true
,
dataType
=
"file"
)})
@PostMapping
(
value
=
"/fileUpload"
)
@PostMapping
(
value
=
"/fileUpload"
)
@ResponseBody
@ResponseBody
public
CyResult
comFileUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"temp"
)
String
temp
)
{
public
CyResult
comFileUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"temp"
)
String
temp
)
throws
IOException
{
return
CyResultGenUtil
.
builder
(
new
CyPersistModel
(
1
),
return
CyResultGenUtil
.
builder
(
new
CyPersistModel
(
1
),
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/sys/ossinfo/service/OssInfoService.java
View file @
8feb14c6
...
@@ -7,6 +7,7 @@ import org.rcisoft.core.model.CyPageInfo;
...
@@ -7,6 +7,7 @@ import org.rcisoft.core.model.CyPageInfo;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -64,7 +65,7 @@ public interface OssInfoService {
...
@@ -64,7 +65,7 @@ public interface OssInfoService {
*/
*/
List
<
OssInfo
>
export
(
OssInfo
ossInfo
);
List
<
OssInfo
>
export
(
OssInfo
ossInfo
);
OssInfo
filePath
(
MultipartFile
file
,
String
temp
);
OssInfo
filePath
(
MultipartFile
file
,
String
temp
)
throws
IOException
;
}
}
src/main/java/org/rcisoft/sys/ossinfo/service/impl/OssInfoServiceImpl.java
View file @
8feb14c6
...
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Propagation;
...
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.rcisoft.core.model.CyPageInfo
;
import
org.rcisoft.core.model.CyPageInfo
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -128,7 +129,7 @@ public class OssInfoServiceImpl extends ServiceImpl<OssInfoRepository, OssInfo>
...
@@ -128,7 +129,7 @@ public class OssInfoServiceImpl extends ServiceImpl<OssInfoRepository, OssInfo>
}
}
@Override
@Override
public
OssInfo
filePath
(
MultipartFile
file
,
String
temp
)
{
public
OssInfo
filePath
(
MultipartFile
file
,
String
temp
)
throws
IOException
{
OssInfo
cyFileEntity
=
ossINfoUtil
.
filePath
(
file
,
temp
);
OssInfo
cyFileEntity
=
ossINfoUtil
.
filePath
(
file
,
temp
);
baseMapper
.
insert
(
cyFileEntity
);
baseMapper
.
insert
(
cyFileEntity
);
cyFileEntity
.
setUrl
(
baseDiscovery
+
cyFileEntity
.
getUrl
());
cyFileEntity
.
setUrl
(
baseDiscovery
+
cyFileEntity
.
getUrl
());
...
...
src/main/java/org/rcisoft/sys/ossinfo/util/OssINfoUtil.java
View file @
8feb14c6
package
org
.
rcisoft
.
sys
.
ossinfo
.
util
;
package
org
.
rcisoft
.
sys
.
ossinfo
.
util
;
import
cn.hutool.core.io.FileUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.core.util.CyDateUtil
;
import
org.rcisoft.core.util.CyDateUtil
;
import
org.rcisoft.sys.ossinfo.entity.OssInfo
;
import
org.rcisoft.sys.ossinfo.entity.OssInfo
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -30,7 +32,7 @@ public class OssINfoUtil {
...
@@ -30,7 +32,7 @@ public class OssINfoUtil {
@Value
(
"${global.path.base_upload_location}"
)
@Value
(
"${global.path.base_upload_location}"
)
private
String
baseUploadLocation
;
private
String
baseUploadLocation
;
public
OssInfo
filePath
(
MultipartFile
multipartFile
,
String
temp
)
{
public
OssInfo
filePath
(
MultipartFile
multipartFile
,
String
temp
)
throws
IOException
{
OssInfo
cyFileEntity
=
new
OssInfo
();
OssInfo
cyFileEntity
=
new
OssInfo
();
// 原文件名
// 原文件名
String
originalName
=
multipartFile
.
getOriginalFilename
();
String
originalName
=
multipartFile
.
getOriginalFilename
();
...
@@ -39,8 +41,14 @@ public class OssINfoUtil {
...
@@ -39,8 +41,14 @@ public class OssINfoUtil {
String
finalSavingPath
;
String
finalSavingPath
;
String
savingPatternOrFullName
=
SAVING_PATTERN_UUID
;
String
savingPatternOrFullName
=
SAVING_PATTERN_UUID
;
String
savingAbsolutePath
=
baseUploadLocation
+
File
.
separator
+
String
savingAbsolutePath
=
""
;
if
(
StringUtils
.
isNotBlank
(
temp
))
savingAbsolutePath
=
baseUploadLocation
+
File
.
separator
+
temp
+
File
.
separator
+
CyDateUtil
.
getSimpleDate
(
"yyyyMMdd"
,
new
Date
());
temp
+
File
.
separator
+
CyDateUtil
.
getSimpleDate
(
"yyyyMMdd"
,
new
Date
());
else
savingAbsolutePath
=
baseUploadLocation
+
File
.
separator
+
CyDateUtil
.
getSimpleDate
(
"yyyyMMdd"
,
new
Date
());
// log.error("savingAbsolutePath"+savingAbsolutePath);
String
returnFinalFileName
=
""
;
String
returnFinalFileName
=
""
;
label32:
label32:
{
{
...
@@ -74,19 +82,31 @@ public class OssINfoUtil {
...
@@ -74,19 +82,31 @@ public class OssINfoUtil {
cyFileEntity
.
setPath
(
path
);
cyFileEntity
.
setPath
(
path
);
cyFileEntity
.
setUrl
(
path
);
cyFileEntity
.
setUrl
(
path
);
cyFileEntity
.
setMd5
(
getMd5
(
multipartFile
));
cyFileEntity
.
setMd5
(
getMd5
(
multipartFile
));
File
dir
=
new
File
(
savingAbsolutePath
);
// File dir = new File(savingAbsolutePath);
if
(!
dir
.
exists
())
{
// if (!dir.exists()) {
dir
.
mkdirs
();
// dir.mkdirs();
}
// }
// if(!FileUtil.exist(savingAbsolutePath)){
// FileUtil.mkdir(savingAbsolutePath);
// }
// log.error("savingAbsolutePath"+savingAbsolutePath);
// log.error("finalSavingPath"+finalSavingPath);
// try {
File
file
=
new
File
(
finalSavingPath
);
File
file
=
new
File
(
finalSavingPath
);
try
{
if
(!
FileUtil
.
exist
(
file
.
getParentFile
())){
FileUtil
.
mkdir
(
file
.
getParentFile
());
log
.
error
(
"file.getParentFile()"
+
file
.
getParentFile
());
}
// log.error("file.getParentFile()"+file.getParentFile());
if
(!
file
.
exists
()
&&
file
.
createNewFile
())
if
(!
file
.
exists
()
&&
file
.
createNewFile
())
multipartFile
.
transferTo
(
file
);
multipartFile
.
transferTo
(
file
);
}
catch
(
IllegalStateException
var10
)
{
//
} catch (IllegalStateException var10) {
log
.
error
(
var10
.
getMessage
());
//
log.error(var10.getMessage());
}
catch
(
IOException
var11
)
{
//
} catch (IOException var11) {
log
.
error
(
var11
.
getMessage
());
//
log.error(var11.getMessage());
}
//
}
return
cyFileEntity
;
return
cyFileEntity
;
}
}
...
...
src/main/resources/mapper/SysUserRepositorys.xml
View file @
8feb14c6
...
@@ -333,6 +333,7 @@
...
@@ -333,6 +333,7 @@
update sys_user
update sys_user
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"entity.name != null and entity.name !='' "
>
name = #{entity.name},
</if>
<if
test=
"entity.name != null and entity.name !='' "
>
name = #{entity.name},
</if>
<if
test=
"entity.faceAddress != null and entity.faceAddress !='' "
>
face_address = #{entity.faceAddress},
</if>
<if
test=
"entity.sex != null and entity.sex !=''"
>
sex = #{entity.sex},
</if>
<if
test=
"entity.sex != null and entity.sex !=''"
>
sex = #{entity.sex},
</if>
<if
test=
"entity.attendanceShow != null and entity.attendanceShow !=''"
>
attendance_show =
<if
test=
"entity.attendanceShow != null and entity.attendanceShow !=''"
>
attendance_show =
#{entity.attendanceShow},
#{entity.attendanceShow},
...
...
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