Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
23d84aa6
Commit
23d84aa6
authored
Jan 29, 2021
by
zhengjiawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
21f61eda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
IPreplanPictureDao.java
.../amos/fas/business/dao/repository/IPreplanPictureDao.java
+6
-0
EquipmentServiceImpl.java
.../amos/fas/business/service/impl/EquipmentServiceImpl.java
+17
-4
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPreplanPictureDao.java
View file @
23d84aa6
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
...
...
@@ -11,6 +13,10 @@ public interface IPreplanPictureDao extends BaseDao<PreplanPicture, Long> {
@Query
(
value
=
"select * from f_preplan_picture where equipment_id=?1 and type = ?2"
,
nativeQuery
=
true
)
PreplanPicture
selectOne
(
Long
id
,
int
type
);
@Transactional
@Modifying
@Query
(
value
=
"delete from f_preplan_picture where equipment_id=?1"
,
nativeQuery
=
true
)
int
deletebyEqId
(
Long
id
);
List
<
PreplanPicture
>
findByEquipmentId
(
Long
equipmentId
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EquipmentServiceImpl.java
View file @
23d84aa6
...
...
@@ -85,6 +85,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Value
(
"${linux.img.path}"
)
private
String
linuxImgPath
;
@Value
(
"${server.servlet.context-path}"
)
private
String
fireAutoSys
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
...
...
@@ -331,6 +334,19 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Override
public
Equipment
saveEquipmentAndImg
(
ImgParam
[]
imgs
,
Equipment
equipment
)
{
String
path
=
FasConstant
.
UPLOAD_ROOT_PATH
+
File
.
separator
+
FasConstant
.
UPLOAD_EQUIPMENT_PATH
+
File
.
separator
+
equipment
.
getId
();
String
filePath
=
getRootPath
()
+
path
;
preplanPictureDao
.
deletebyEqId
(
equipment
.
getId
());
File
file1
=
new
File
(
filePath
);
if
(
file1
.
exists
()){
File
[]
files
=
file1
.
listFiles
();
if
(
files
.
length
>
0
){
for
(
File
f:
files
)
{
f
.
delete
();
}
}
}
// TODO Auto-generated method stub
if
(
imgs
==
null
||
imgs
.
length
<
1
)
{
equipment
=
save
(
equipment
);
...
...
@@ -369,9 +385,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
pp
.
setCreateDate
(
new
Date
());
}
String
path
=
FasConstant
.
UPLOAD_ROOT_PATH
+
File
.
separator
+
FasConstant
.
UPLOAD_EQUIPMENT_PATH
+
File
.
separator
+
equipment
.
getId
();
String
filePath
=
getRootPath
()
+
path
;
String
fileType
=
file
.
getOriginalFilename
().
substring
(
file
.
getOriginalFilename
().
lastIndexOf
(
"."
),
file
.
getOriginalFilename
().
length
());
...
...
@@ -390,7 +403,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
String
picture
=
fireAutoSys
+
"/"
+
path
+
fileName
;
pp
.
setPicture
(
picture
);
preplanPictureDao
.
saveAndFlush
(
pp
);
}
...
...
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