Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhny
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
王夏晖
zhny
Commits
9d94f300
Commit
9d94f300
authored
May 09, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备类型图片上传
parent
d190a75e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
2 deletions
+44
-2
BusDeviceTpController.java
...oft/business/manage/controller/BusDeviceTpController.java
+7
-0
BusDeviceTp.java
.../java/org/rcisoft/business/manage/entity/BusDeviceTp.java
+2
-0
BusDeviceTpService.java
...g/rcisoft/business/manage/service/BusDeviceTpService.java
+2
-1
BusDeviceTpServiceImpl.java
.../business/manage/service/impl/BusDeviceTpServiceImpl.java
+30
-0
application.yml
src/main/resources/application.yml
+2
-1
BusDeviceTpMapper.xml
.../resources/mapper/sys/manage.mapper/BusDeviceTpMapper.xml
+1
-0
No files found.
src/main/java/org/rcisoft/business/manage/controller/BusDeviceTpController.java
View file @
9d94f300
...
...
@@ -11,6 +11,7 @@ import org.rcisoft.core.model.PersistModel;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.Valid
;
import
java.util.List
;
...
...
@@ -63,4 +64,10 @@ public class BusDeviceTpController extends PaginationController<BusDeviceTp> {
public
List
<
Map
<
String
,
Object
>>
queryBusDeviceTpList
(
@RequestParam
String
proId
)
{
return
busDeviceTpServiceImpl
.
queryBusDeviceTpList
(
proId
);
}
@RequestMapping
(
"/upload"
)
public
Result
upload
(
@RequestParam
MultipartFile
file
,
@RequestParam
String
devTpId
)
{
PersistModel
pm
=
busDeviceTpServiceImpl
.
upload
(
file
,
devTpId
);
return
Result
.
builder
(
pm
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
null
);
}
}
src/main/java/org/rcisoft/business/manage/entity/BusDeviceTp.java
View file @
9d94f300
...
...
@@ -24,6 +24,8 @@ public class BusDeviceTp{
private
String
devTpNm
;
private
String
devTpImg
;
}
src/main/java/org/rcisoft/business/manage/service/BusDeviceTpService.java
View file @
9d94f300
...
...
@@ -2,6 +2,7 @@ package org.rcisoft.business.manage.service;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -40,6 +41,6 @@ public interface BusDeviceTpService {
List
<
Map
<
String
,
Object
>>
queryBusDeviceTpList
(
String
proId
);
PersistModel
upload
(
MultipartFile
file
,
String
devTpId
);
}
src/main/java/org/rcisoft/business/manage/service/impl/BusDeviceTpServiceImpl.java
View file @
9d94f300
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.rcisoft.business.manage.dao.BusDeviceTpRepository
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
...
...
@@ -9,12 +10,15 @@ import org.rcisoft.business.manage.service.BusDeviceTpService;
import
org.rcisoft.business.manage.service.BusDevicetpParamService
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
tk.mybatis.mapper.entity.Example
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -32,6 +36,8 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
private
BusDeviceTpRepository
busDeviceTpRepository
;
@Autowired
private
BusDevicetpParamService
busDevicetpParamService
;
@Value
(
"${filepath.devicetp}"
)
private
String
filepath
;
/**
...
...
@@ -90,5 +96,29 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
return
list
;
}
@Override
public
PersistModel
upload
(
MultipartFile
file
,
String
devTpId
)
{
int
line
=
1
;
String
fileName
=
file
.
getOriginalFilename
();
String
suffixName
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
//文件路径
String
savePath
=
filepath
+
devTpId
+
suffixName
;
File
saveFile
=
new
File
(
savePath
);
if
(
saveFile
.
exists
()){
line
=
0
;
}
try
{
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
saveFile
);
BusDeviceTp
busDeviceTp
=
new
BusDeviceTp
();
busDeviceTp
.
setDevTpId
(
devTpId
);
busDeviceTp
.
setDevTpImg
(
savePath
);
merge
(
busDeviceTp
);
line
=
1
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
new
PersistModel
(
line
);
}
}
src/main/resources/application.yml
View file @
9d94f300
...
...
@@ -4,4 +4,5 @@ spring:
filepath
:
analysis
:
D:\zhny\filepath\analysis\
equipment
:
D:\zhny\filepath\equipment\
\ No newline at end of file
equipment
:
D:\zhny\filepath\equipment\
devicetp
:
D:\zhny\filepath\devicetp\
\ No newline at end of file
src/main/resources/mapper/sys/manage.mapper/BusDeviceTpMapper.xml
View file @
9d94f300
...
...
@@ -4,6 +4,7 @@
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusDeviceTp"
>
<id
column=
"DEV_TP_ID"
jdbcType=
"VARCHAR"
property=
"devTpId"
/>
<result
column=
"DEV_TP_NM"
jdbcType=
"VARCHAR"
property=
"devTpNm"
/>
<result
column=
"DEV_TP_IMG"
jdbcType=
"VARCHAR"
property=
"devTpImg"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
...
...
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