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
c46de4ff
Commit
c46de4ff
authored
Nov 26, 2020
by
lizehua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除报错,以及修改查询数据sql
parent
f01a5c93
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
530 additions
and
536 deletions
+530
-536
FireEquipMapper.java
...yeejoin/amos/fas/business/dao/mapper/FireEquipMapper.java
+0
-2
EquipmentServiceImpl.java
.../amos/fas/business/service/impl/EquipmentServiceImpl.java
+496
-511
IEquipmentService.java
...in/amos/fas/business/service/intfc/IEquipmentService.java
+0
-2
dbTemplate_fire_equip.xml
...rt/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
+0
-19
dbTemplate_view3d.xml
...sStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
+34
-2
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/FireEquipMapper.java
View file @
c46de4ff
...
...
@@ -57,8 +57,6 @@ public interface FireEquipMapper extends BaseMapper {
EquipDetailsResponse
findEquipDetailsById
(
@Param
(
"id"
)
Long
id
);
List
<
EquipCommunicationData
>
findAllEquipPointInfo
();
EquipCommunicationData
findOneByPointCode
(
@Param
(
"code"
)
String
code
);
void
saveBatch
(
List
<
FireEquipmentParam
>
list
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EquipmentServiceImpl.java
View file @
c46de4ff
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
javax.annotation.PostConstruct
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort.Direction
;
import
org.springframework.data.domain.Sort.Order
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFmeaEquipmentPointDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.param.ImgParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.response.EquipDetailsResponse
;
import
com.yeejoin.amos.fas.core.util.DaoCriteria
;
import
com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
@Service
(
"equipService"
)
public
class
EquipmentServiceImpl
implements
IEquipmentService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
EquipmentServiceImpl
.
class
);
@Autowired
ImpEquipMapper
impEquipMapper
;
@Autowired
FireEquipMapper
fireEquipMapper
;
@Autowired
IEquipmentDao
iEquipmentDao
;
@Autowired
IPreplanPictureDao
iPreplanPictureDao
;
@Autowired
IEquipmentFireEquipmentDao
equipmentFireEquipmentDao
;
@Autowired
IFireEquipmentDao
iFireEquipmentDao
;
@Autowired
ImpAndFireEquipMapper
impAndFireEquipMapper
;
@Autowired
private
IPreplanPictureDao
preplanPictureDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
IFmeaEquipmentPointDao
iFmeaEquipmentPointDao
;
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
EquipCommunicationDao
equipCommunicationDao
;
@Value
(
"${windows.img.path}"
)
private
String
winImgPath
;
@Value
(
"${linux.img.path}"
)
private
String
linuxImgPath
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
public
Equipment
save
(
Equipment
equipment
)
{
Long
eqId
=
equipment
.
getId
();
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
return
equipment
;
}
public
Equipment
queryOne
(
Long
id
)
{
Optional
<
Equipment
>
dict1
=
iEquipmentDao
.
findById
(
id
);
Equipment
dict
=
null
;
if
(
dict1
.
isPresent
()){
dict
=
dict1
.
get
();
}
return
dict
;
}
@Override
@Transactional
public
String
[]
delete
(
String
[]
idArray
)
throws
Exception
{
for
(
String
id
:
idArray
)
{
Optional
<
Equipment
>
equipment1
=
iEquipmentDao
.
findById
(
Long
.
parseLong
(
id
));
Equipment
equipment
=
null
;
if
(
equipment1
.
isPresent
()){
equipment
=
equipment1
.
get
();
}
if
(
equipment
!=
null
)
{
List
<
EquipmentFireEquipment
>
eqFireEqs
=
equipmentFireEquipmentDao
.
findAllByEquipmentId
(
equipment
.
getId
());
if
(!
eqFireEqs
.
isEmpty
()){
equipmentFireEquipmentDao
.
deleteAll
(
eqFireEqs
);
}
this
.
iEquipmentDao
.
deleteById
(
Long
.
parseLong
(
id
));
}
else
{
throw
new
Exception
(
"找不到指定的对象:"
+
id
);
}
//删除重点设备关联关系
equipmentFireEquipmentDao
.
deleteByEquipmentId
(
Long
.
valueOf
(
id
));
}
return
idArray
;
}
@Override
public
List
<
PreplanPicture
>
queryImgByIdAndType
(
List
<
DaoCriteria
>
criterias
)
{
BaseQuerySpecification
<
PreplanPicture
>
spec
=
new
BaseQuerySpecification
<>(
criterias
);
return
iPreplanPictureDao
.
findAll
(
spec
);
}
@Override
public
Page
<
Equipment
>
queryImpEquip
(
List
<
DaoCriteria
>
criterias
,
CommonPageable
commonPageable
)
{
String
name
=
""
;
String
id
=
""
;
for
(
DaoCriteria
criteria
:
criterias
)
{
if
(
criteria
.
getPropertyName
().
equals
(
"name"
))
{
name
=
String
.
valueOf
(
criteria
.
getValue
()
!=
null
?
criteria
.
getValue
().
toString
()
:
""
);
}
if
(
criteria
.
getPropertyName
().
equals
(
"id"
))
{
id
=
String
.
valueOf
(
criteria
.
getValue
()
!=
null
?
criteria
.
getValue
().
toString
()
:
""
);
}
}
Long
total
=
impEquipMapper
.
getEquipPageCount
(
name
,
id
);
List
<
Map
>
content
=
impEquipMapper
.
getEquipPage
(
name
,
id
,
commonPageable
.
getOffset
(),
commonPageable
.
getPageSize
());
Page
result
=
new
PageImpl
(
content
,
commonPageable
,
total
);
return
result
;
}
@Override
public
List
<
Equipment
>
queryEquipNoPage
()
{
return
iEquipmentDao
.
findAll
();
}
/**
* 绑定消防设备
*
* @param list
* @return
* @throws Exception
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
Map
<
String
,
Object
>>
bindFireEqumt
(
Long
equipmentId
,
List
<
EquipmentFireEquipment
>
list
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
EquipmentFireEquipment
equipmentFireEquipment
:
list
)
{
int
count
=
equipmentFireEquipmentDao
.
findByEqmtIdAndFireEqmtId
(
equipmentId
,
equipmentFireEquipment
.
getFireEquipmentId
());
if
(
count
>
0
)
{
continue
;
}
equipmentFireEquipment
.
setEquipmentId
(
equipmentId
);
equipmentFireEquipment
.
setCreateDate
(
new
Date
());
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"exits"
,
false
);
Equipment
equipment
=
this
.
iEquipmentDao
.
getOne
(
equipmentFireEquipment
.
getEquipmentId
().
longValue
());
FireEquipment
fireEquipment
=
iFireEquipmentDao
.
getOne
(
equipmentFireEquipment
.
getFireEquipmentId
().
longValue
());
if
(
equipment
==
null
||
fireEquipment
==
null
)
throw
new
Exception
(
"找不到数据"
);
this
.
equipmentFireEquipmentDao
.
save
(
equipmentFireEquipment
);
//已存在的绑定关系
List
<
EquipmentFireEquipment
>
exits
=
impAndFireEquipMapper
.
queryForList
(
String
.
valueOf
(
equipmentFireEquipment
.
getFireEquipmentId
()),
null
);
if
(!
CollectionUtils
.
isEmpty
(
exits
))
result
.
put
(
"exits"
,
true
);
result
.
put
(
"newModel"
,
equipmentFireEquipment
);
resultList
.
add
(
result
);
}
return
resultList
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
Long
>
removeFireEqmtBind
(
Long
equipmentId
,
String
[]
fireEquipmentIds
)
{
List
<
Long
>
ids
=
new
ArrayList
<>();
for
(
String
id
:
fireEquipmentIds
)
{
long
result
=
0
;
EquipmentFireEquipment
equipmentFireEquipment
=
impAndFireEquipMapper
.
queryForOne
(
String
.
valueOf
(
id
),
String
.
valueOf
(
equipmentId
));
if
(
equipmentFireEquipment
!=
null
)
{
result
=
equipmentFireEquipment
.
getId
();
this
.
equipmentFireEquipmentDao
.
deleteById
(
equipmentFireEquipment
.
getId
());
fireEquipMapper
.
removeIfmeaPointByFireEquipIdAndEquipId
(
Long
.
valueOf
(
id
),
equipmentId
);
//iFmeaEquipmentPointDao.removeByFireEquipIdAndEquipId(Long.valueOf(id), equipmentId);
}
ids
.
add
(
result
);
}
return
ids
;
}
/**
* 查询指定重点设备已经绑定的消防设备
*
* @param equipmentId
* @return
*/
@Override
public
Page
queryBindFirEqumtList
(
CommonPageable
commonPageable
,
Long
equipmentId
)
{
long
start
=
-
1
;
int
length
=
-
1
;
if
(
null
!=
commonPageable
)
{
start
=
commonPageable
.
getOffset
();
length
=
commonPageable
.
getPageSize
();
}
long
total
=
this
.
impAndFireEquipMapper
.
queryBindFirEqumtPageCount
(
String
.
valueOf
(
equipmentId
));
List
<
FireEquipment
>
list
=
this
.
impAndFireEquipMapper
.
queryBindFirEqumtPage
(
start
,
length
,
String
.
valueOf
(
equipmentId
));
if
(
commonPageable
==
null
)
{
commonPageable
=
new
CommonPageable
();
}
Page
result
=
new
PageImpl
(
list
,
commonPageable
,
total
);
return
result
;
}
@Override
public
Equipment
saveImg
(
MultipartFile
file
,
Equipment
equipment
,
int
type
,
Long
userId
)
{
// TODO Auto-generated method stub
Long
equipmentId
=
Long
.
valueOf
(
equipment
.
getId
());
PreplanPicture
pp
=
preplanPictureDao
.
selectOne
(
equipmentId
,
type
);
if
(
pp
==
null
)
{
pp
=
new
PreplanPicture
();
pp
.
setEquipmentId
(
equipmentId
);
pp
.
setType
(
type
);
pp
.
setCreateDate
(
new
Date
());
pp
.
setCreateBy
(
userId
.
intValue
()+
""
);
}
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
());
String
fileName
=
File
.
separator
+
type
+
fileType
;
try
{
File
dest
=
new
File
(
filePath
+
File
.
separator
+
fileName
);
if
(!
dest
.
exists
())
{
if
(
dest
.
getParentFile
()
!=
null
&&
!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
}
dest
.
createNewFile
();
}
file
.
transferTo
(
dest
);
}
catch
(
IOException
e
)
{
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
pp
.
setCreateBy
(
userId
.
intValue
()+
""
);
pp
.
setPicture
(
picture
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
());
}
preplanPictureDao
.
saveAndFlush
(
pp
);
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
return
equipment
;
}
private
String
getRootPath
()
{
String
localPath
=
""
;
if
(
"\\"
.
equals
(
File
.
separator
))
{
localPath
+=
winImgPath
;
}
else
if
(
"/"
.
equals
(
File
.
separator
))
{
localPath
+=
linuxImgPath
;
}
return
localPath
.
trim
();
}
@Override
public
Equipment
saveEquipmentAndImg
(
ImgParam
[]
imgs
,
Equipment
equipment
)
{
// TODO Auto-generated method stub
if
(
imgs
==
null
||
imgs
.
length
<
1
)
{
equipment
=
save
(
equipment
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
()
==
null
?
new
Date
()
:
equipment2
.
getCreateDate
());
}
}
else
{
equipment
=
save
(
equipment
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
()
==
null
?
new
Date
()
:
equipment2
.
getCreateDate
());
}
Long
equipmentId
=
Long
.
valueOf
(
equipment
.
getId
());
for
(
int
i
=
0
;
i
<
imgs
.
length
;
i
++)
{
MultipartFile
file
=
imgs
[
i
].
getFile
();
if
(
null
!=
file
)
{
int
type
=
imgs
[
i
].
getType
();
PreplanPicture
pp
=
preplanPictureDao
.
selectOne
(
equipmentId
,
type
);
if
(
pp
==
null
)
{
pp
=
new
PreplanPicture
();
pp
.
setEquipmentId
(
equipmentId
);
pp
.
setType
(
type
);
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
());
String
fileName
=
File
.
separator
+
type
+
fileType
;
try
{
File
dest
=
new
File
(
filePath
+
File
.
separator
+
fileName
);
if
(!
dest
.
exists
())
{
if
(
dest
.
getParentFile
()
!=
null
&&
!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
}
dest
.
createNewFile
();
}
file
.
transferTo
(
dest
);
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
pp
.
setPicture
(
picture
);
preplanPictureDao
.
saveAndFlush
(
pp
);
}
}
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
}
return
equipment
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
findEquipVideoList
()
{
List
<
Map
<
String
,
Object
>>
list
=
impAndFireEquipMapper
.
findEquipVideo
();
Map
<
String
,
Map
<
String
,
Object
>>
tempEquip
=
new
HashMap
<
String
,
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<
Map
<
String
,
Object
>>();
for
(
Map
<
String
,
Object
>
temp
:
list
)
{
Map
<
String
,
Object
>
equip
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
video
=
new
HashMap
<
String
,
Object
>();
video
.
put
(
"id"
,
temp
.
get
(
"id"
));
video
.
put
(
"code"
,
temp
.
get
(
"code"
));
video
.
put
(
"name"
,
temp
.
get
(
"name"
));
video
.
put
(
"videoUrl"
,
temp
.
get
(
"url"
));
video
.
put
(
"equipName"
,
temp
.
get
(
"equipName"
));
video
.
put
(
"monitorTime"
,
new
Date
());
List
<
Map
<
String
,
Object
>>
videoList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
if
(
tempEquip
.
containsKey
(
temp
.
get
(
"equipId"
).
toString
()))
{
equip
=
tempEquip
.
get
(
temp
.
get
(
"equipId"
).
toString
());
videoList
=
(
List
<
Map
<
String
,
Object
>>)
equip
.
get
(
"children"
);
videoList
.
add
(
video
);
}
else
{
equip
.
put
(
"equipId"
,
temp
.
get
(
"equipId"
));
equip
.
put
(
"equipName"
,
temp
.
get
(
"equipName"
));
equip
.
put
(
"equipCode"
,
temp
.
get
(
"equipCode"
));
videoList
.
add
(
video
);
equip
.
put
(
"children"
,
videoList
);
tempEquip
.
put
(
temp
.
get
(
"equipId"
).
toString
(),
equip
);
result
.
add
(
equip
);
}
}
return
result
;
}
@Override
public
EquipDetailsResponse
findEquipDetailsById
(
String
toke
,
String
product
,
String
appKey
,
Long
id
)
{
EquipDetailsResponse
equipDetailsResponse
=
fireEquipMapper
.
findEquipDetailsById
(
id
);
AgencyUserModel
user
=
remoteSecurityService
.
getUserById
(
toke
,
product
,
appKey
,
equipDetailsResponse
.
getUserId
());
equipDetailsResponse
.
setUsername
(
user
.
getRealName
());
equipDetailsResponse
.
setTel
(
user
.
getMobile
());
if
(
user
.
getCompanys
().
get
(
0
)!=
null
)
{
CompanyModel
companyModel
=
user
.
getCompanys
().
get
(
0
);
if
(
user
.
getCompanyDepartments
().
get
(
companyModel
.
getSequenceNbr
())!=
null
)
{
List
<
DepartmentModel
>
departList
=
user
.
getCompanyDepartments
().
get
(
companyModel
.
getSequenceNbr
());
if
(!
departList
.
isEmpty
())
{
equipDetailsResponse
.
setDepName
(
departList
.
get
(
0
).
getDepartmentName
());
}
}
}
return
equipDetailsResponse
;
}
@Override
public
List
<
Equipment
>
findAll
()
{
return
iEquipmentDao
.
findAll
();
}
@Override
@PostConstruct
public
void
findAllEquipPointInfo
()
{
List
<
EquipCommunicationData
>
list
=
fireEquipMapper
.
findAllEquipPointInfo
();
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
HashMap
<
String
,
EquipCommunicationData
>
map
=
new
HashMap
<>();
list
.
forEach
(
data
->
{
map
.
put
(
data
.
getPointCode
(),
data
);
});
redisTemplate
.
opsForHash
().
putAll
(
"fireEquipData"
,
map
);
}
}
@Override
public
EquipCommunicationData
findFireEquipmentByPointCode
(
String
code
)
{
// EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
// if (ObjectUtils.isEmpty(data)) {
EquipCommunicationData
data
=
fireEquipMapper
.
findOneByPointCode
(
code
);
// }
return
data
;
}
@Override
public
EquipCommunicationData
findFireEquipDataByPointCode
(
String
code
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"pointCode"
).
is
(
code
)).
limit
(
1
);
query
.
with
(
new
Sort
(
new
Order
(
Direction
.
DESC
,
"recDate"
)));
query
.
limit
(
1
);
List
<
EquipCommunicationData
>
data
=
mongoTemplate
.
find
(
query
,
EquipCommunicationData
.
class
);
if
(
data
.
isEmpty
())
{
return
null
;
}
return
data
.
get
(
0
);
}
@Override
public
int
countImpEquipByIds
(
String
[]
idArray
)
{
return
equipmentFireEquipmentDao
.
countImpEquipByIds
(
idArray
);
}
@Override
public
int
countFemaRelation
(
String
[]
idArray
)
{
return
iEquipmentDao
.
countFemaRelation
(
idArray
);
}
}
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
javax.annotation.PostConstruct
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort.Direction
;
import
org.springframework.data.domain.Sort.Order
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFmeaEquipmentPointDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.param.ImgParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.response.EquipDetailsResponse
;
import
com.yeejoin.amos.fas.core.util.DaoCriteria
;
import
com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
@Service
(
"equipService"
)
public
class
EquipmentServiceImpl
implements
IEquipmentService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
EquipmentServiceImpl
.
class
);
@Autowired
ImpEquipMapper
impEquipMapper
;
@Autowired
FireEquipMapper
fireEquipMapper
;
@Autowired
IEquipmentDao
iEquipmentDao
;
@Autowired
IPreplanPictureDao
iPreplanPictureDao
;
@Autowired
IEquipmentFireEquipmentDao
equipmentFireEquipmentDao
;
@Autowired
IFireEquipmentDao
iFireEquipmentDao
;
@Autowired
ImpAndFireEquipMapper
impAndFireEquipMapper
;
@Autowired
private
IPreplanPictureDao
preplanPictureDao
;
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
IFmeaEquipmentPointDao
iFmeaEquipmentPointDao
;
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
EquipCommunicationDao
equipCommunicationDao
;
@Value
(
"${windows.img.path}"
)
private
String
winImgPath
;
@Value
(
"${linux.img.path}"
)
private
String
linuxImgPath
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
public
Equipment
save
(
Equipment
equipment
)
{
Long
eqId
=
equipment
.
getId
();
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
return
equipment
;
}
public
Equipment
queryOne
(
Long
id
)
{
Optional
<
Equipment
>
dict1
=
iEquipmentDao
.
findById
(
id
);
Equipment
dict
=
null
;
if
(
dict1
.
isPresent
()){
dict
=
dict1
.
get
();
}
return
dict
;
}
@Override
@Transactional
public
String
[]
delete
(
String
[]
idArray
)
throws
Exception
{
for
(
String
id
:
idArray
)
{
Optional
<
Equipment
>
equipment1
=
iEquipmentDao
.
findById
(
Long
.
parseLong
(
id
));
Equipment
equipment
=
null
;
if
(
equipment1
.
isPresent
()){
equipment
=
equipment1
.
get
();
}
if
(
equipment
!=
null
)
{
List
<
EquipmentFireEquipment
>
eqFireEqs
=
equipmentFireEquipmentDao
.
findAllByEquipmentId
(
equipment
.
getId
());
if
(!
eqFireEqs
.
isEmpty
()){
equipmentFireEquipmentDao
.
deleteAll
(
eqFireEqs
);
}
this
.
iEquipmentDao
.
deleteById
(
Long
.
parseLong
(
id
));
}
else
{
throw
new
Exception
(
"找不到指定的对象:"
+
id
);
}
//删除重点设备关联关系
equipmentFireEquipmentDao
.
deleteByEquipmentId
(
Long
.
valueOf
(
id
));
}
return
idArray
;
}
@Override
public
List
<
PreplanPicture
>
queryImgByIdAndType
(
List
<
DaoCriteria
>
criterias
)
{
BaseQuerySpecification
<
PreplanPicture
>
spec
=
new
BaseQuerySpecification
<>(
criterias
);
return
iPreplanPictureDao
.
findAll
(
spec
);
}
@Override
public
Page
<
Equipment
>
queryImpEquip
(
List
<
DaoCriteria
>
criterias
,
CommonPageable
commonPageable
)
{
String
name
=
""
;
String
id
=
""
;
for
(
DaoCriteria
criteria
:
criterias
)
{
if
(
criteria
.
getPropertyName
().
equals
(
"name"
))
{
name
=
String
.
valueOf
(
criteria
.
getValue
()
!=
null
?
criteria
.
getValue
().
toString
()
:
""
);
}
if
(
criteria
.
getPropertyName
().
equals
(
"id"
))
{
id
=
String
.
valueOf
(
criteria
.
getValue
()
!=
null
?
criteria
.
getValue
().
toString
()
:
""
);
}
}
Long
total
=
impEquipMapper
.
getEquipPageCount
(
name
,
id
);
List
<
Map
>
content
=
impEquipMapper
.
getEquipPage
(
name
,
id
,
commonPageable
.
getOffset
(),
commonPageable
.
getPageSize
());
Page
result
=
new
PageImpl
(
content
,
commonPageable
,
total
);
return
result
;
}
@Override
public
List
<
Equipment
>
queryEquipNoPage
()
{
return
iEquipmentDao
.
findAll
();
}
/**
* 绑定消防设备
*
* @param list
* @return
* @throws Exception
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
Map
<
String
,
Object
>>
bindFireEqumt
(
Long
equipmentId
,
List
<
EquipmentFireEquipment
>
list
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
EquipmentFireEquipment
equipmentFireEquipment
:
list
)
{
int
count
=
equipmentFireEquipmentDao
.
findByEqmtIdAndFireEqmtId
(
equipmentId
,
equipmentFireEquipment
.
getFireEquipmentId
());
if
(
count
>
0
)
{
continue
;
}
equipmentFireEquipment
.
setEquipmentId
(
equipmentId
);
equipmentFireEquipment
.
setCreateDate
(
new
Date
());
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"exits"
,
false
);
Equipment
equipment
=
this
.
iEquipmentDao
.
getOne
(
equipmentFireEquipment
.
getEquipmentId
().
longValue
());
FireEquipment
fireEquipment
=
iFireEquipmentDao
.
getOne
(
equipmentFireEquipment
.
getFireEquipmentId
().
longValue
());
if
(
equipment
==
null
||
fireEquipment
==
null
)
throw
new
Exception
(
"找不到数据"
);
this
.
equipmentFireEquipmentDao
.
save
(
equipmentFireEquipment
);
//已存在的绑定关系
List
<
EquipmentFireEquipment
>
exits
=
impAndFireEquipMapper
.
queryForList
(
String
.
valueOf
(
equipmentFireEquipment
.
getFireEquipmentId
()),
null
);
if
(!
CollectionUtils
.
isEmpty
(
exits
))
result
.
put
(
"exits"
,
true
);
result
.
put
(
"newModel"
,
equipmentFireEquipment
);
resultList
.
add
(
result
);
}
return
resultList
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
Long
>
removeFireEqmtBind
(
Long
equipmentId
,
String
[]
fireEquipmentIds
)
{
List
<
Long
>
ids
=
new
ArrayList
<>();
for
(
String
id
:
fireEquipmentIds
)
{
long
result
=
0
;
EquipmentFireEquipment
equipmentFireEquipment
=
impAndFireEquipMapper
.
queryForOne
(
String
.
valueOf
(
id
),
String
.
valueOf
(
equipmentId
));
if
(
equipmentFireEquipment
!=
null
)
{
result
=
equipmentFireEquipment
.
getId
();
this
.
equipmentFireEquipmentDao
.
deleteById
(
equipmentFireEquipment
.
getId
());
fireEquipMapper
.
removeIfmeaPointByFireEquipIdAndEquipId
(
Long
.
valueOf
(
id
),
equipmentId
);
//iFmeaEquipmentPointDao.removeByFireEquipIdAndEquipId(Long.valueOf(id), equipmentId);
}
ids
.
add
(
result
);
}
return
ids
;
}
/**
* 查询指定重点设备已经绑定的消防设备
*
* @param equipmentId
* @return
*/
@Override
public
Page
queryBindFirEqumtList
(
CommonPageable
commonPageable
,
Long
equipmentId
)
{
long
start
=
-
1
;
int
length
=
-
1
;
if
(
null
!=
commonPageable
)
{
start
=
commonPageable
.
getOffset
();
length
=
commonPageable
.
getPageSize
();
}
long
total
=
this
.
impAndFireEquipMapper
.
queryBindFirEqumtPageCount
(
String
.
valueOf
(
equipmentId
));
List
<
FireEquipment
>
list
=
this
.
impAndFireEquipMapper
.
queryBindFirEqumtPage
(
start
,
length
,
String
.
valueOf
(
equipmentId
));
if
(
commonPageable
==
null
)
{
commonPageable
=
new
CommonPageable
();
}
Page
result
=
new
PageImpl
(
list
,
commonPageable
,
total
);
return
result
;
}
@Override
public
Equipment
saveImg
(
MultipartFile
file
,
Equipment
equipment
,
int
type
,
Long
userId
)
{
// TODO Auto-generated method stub
Long
equipmentId
=
Long
.
valueOf
(
equipment
.
getId
());
PreplanPicture
pp
=
preplanPictureDao
.
selectOne
(
equipmentId
,
type
);
if
(
pp
==
null
)
{
pp
=
new
PreplanPicture
();
pp
.
setEquipmentId
(
equipmentId
);
pp
.
setType
(
type
);
pp
.
setCreateDate
(
new
Date
());
pp
.
setCreateBy
(
userId
.
intValue
()+
""
);
}
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
());
String
fileName
=
File
.
separator
+
type
+
fileType
;
try
{
File
dest
=
new
File
(
filePath
+
File
.
separator
+
fileName
);
if
(!
dest
.
exists
())
{
if
(
dest
.
getParentFile
()
!=
null
&&
!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
}
dest
.
createNewFile
();
}
file
.
transferTo
(
dest
);
}
catch
(
IOException
e
)
{
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
pp
.
setCreateBy
(
userId
.
intValue
()+
""
);
pp
.
setPicture
(
picture
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
());
}
preplanPictureDao
.
saveAndFlush
(
pp
);
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
return
equipment
;
}
private
String
getRootPath
()
{
String
localPath
=
""
;
if
(
"\\"
.
equals
(
File
.
separator
))
{
localPath
+=
winImgPath
;
}
else
if
(
"/"
.
equals
(
File
.
separator
))
{
localPath
+=
linuxImgPath
;
}
return
localPath
.
trim
();
}
@Override
public
Equipment
saveEquipmentAndImg
(
ImgParam
[]
imgs
,
Equipment
equipment
)
{
// TODO Auto-generated method stub
if
(
imgs
==
null
||
imgs
.
length
<
1
)
{
equipment
=
save
(
equipment
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
()
==
null
?
new
Date
()
:
equipment2
.
getCreateDate
());
}
}
else
{
equipment
=
save
(
equipment
);
if
(
equipment
.
getCreateDate
()
==
null
)
{
Optional
<
Equipment
>
date
=
iEquipmentDao
.
findById
(
equipment
.
getId
());
Equipment
equipment2
=
null
;
if
(
date
.
isPresent
()){
equipment2
=
date
.
get
();
}
equipment
.
setCreateDate
(
equipment2
.
getCreateDate
()
==
null
?
new
Date
()
:
equipment2
.
getCreateDate
());
}
Long
equipmentId
=
Long
.
valueOf
(
equipment
.
getId
());
for
(
int
i
=
0
;
i
<
imgs
.
length
;
i
++)
{
MultipartFile
file
=
imgs
[
i
].
getFile
();
if
(
null
!=
file
)
{
int
type
=
imgs
[
i
].
getType
();
PreplanPicture
pp
=
preplanPictureDao
.
selectOne
(
equipmentId
,
type
);
if
(
pp
==
null
)
{
pp
=
new
PreplanPicture
();
pp
.
setEquipmentId
(
equipmentId
);
pp
.
setType
(
type
);
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
());
String
fileName
=
File
.
separator
+
type
+
fileType
;
try
{
File
dest
=
new
File
(
filePath
+
File
.
separator
+
fileName
);
if
(!
dest
.
exists
())
{
if
(
dest
.
getParentFile
()
!=
null
&&
!
dest
.
getParentFile
().
exists
())
{
dest
.
getParentFile
().
mkdirs
();
}
dest
.
createNewFile
();
}
file
.
transferTo
(
dest
);
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
YeeException
(
"上传图片失败"
);
}
String
picture
=
path
+
fileName
;
pp
.
setPicture
(
picture
);
preplanPictureDao
.
saveAndFlush
(
pp
);
}
}
equipment
=
iEquipmentDao
.
saveAndFlush
(
equipment
);
}
return
equipment
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
findEquipVideoList
()
{
List
<
Map
<
String
,
Object
>>
list
=
impAndFireEquipMapper
.
findEquipVideo
();
Map
<
String
,
Map
<
String
,
Object
>>
tempEquip
=
new
HashMap
<
String
,
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<
Map
<
String
,
Object
>>();
for
(
Map
<
String
,
Object
>
temp
:
list
)
{
Map
<
String
,
Object
>
equip
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
video
=
new
HashMap
<
String
,
Object
>();
video
.
put
(
"id"
,
temp
.
get
(
"id"
));
video
.
put
(
"code"
,
temp
.
get
(
"code"
));
video
.
put
(
"name"
,
temp
.
get
(
"name"
));
video
.
put
(
"videoUrl"
,
temp
.
get
(
"url"
));
video
.
put
(
"equipName"
,
temp
.
get
(
"equipName"
));
video
.
put
(
"monitorTime"
,
new
Date
());
List
<
Map
<
String
,
Object
>>
videoList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
if
(
tempEquip
.
containsKey
(
temp
.
get
(
"equipId"
).
toString
()))
{
equip
=
tempEquip
.
get
(
temp
.
get
(
"equipId"
).
toString
());
videoList
=
(
List
<
Map
<
String
,
Object
>>)
equip
.
get
(
"children"
);
videoList
.
add
(
video
);
}
else
{
equip
.
put
(
"equipId"
,
temp
.
get
(
"equipId"
));
equip
.
put
(
"equipName"
,
temp
.
get
(
"equipName"
));
equip
.
put
(
"equipCode"
,
temp
.
get
(
"equipCode"
));
videoList
.
add
(
video
);
equip
.
put
(
"children"
,
videoList
);
tempEquip
.
put
(
temp
.
get
(
"equipId"
).
toString
(),
equip
);
result
.
add
(
equip
);
}
}
return
result
;
}
@Override
public
EquipDetailsResponse
findEquipDetailsById
(
String
toke
,
String
product
,
String
appKey
,
Long
id
)
{
EquipDetailsResponse
equipDetailsResponse
=
fireEquipMapper
.
findEquipDetailsById
(
id
);
AgencyUserModel
user
=
remoteSecurityService
.
getUserById
(
toke
,
product
,
appKey
,
equipDetailsResponse
.
getUserId
());
equipDetailsResponse
.
setUsername
(
user
.
getRealName
());
equipDetailsResponse
.
setTel
(
user
.
getMobile
());
if
(
user
.
getCompanys
().
get
(
0
)!=
null
)
{
CompanyModel
companyModel
=
user
.
getCompanys
().
get
(
0
);
if
(
user
.
getCompanyDepartments
().
get
(
companyModel
.
getSequenceNbr
())!=
null
)
{
List
<
DepartmentModel
>
departList
=
user
.
getCompanyDepartments
().
get
(
companyModel
.
getSequenceNbr
());
if
(!
departList
.
isEmpty
())
{
equipDetailsResponse
.
setDepName
(
departList
.
get
(
0
).
getDepartmentName
());
}
}
}
return
equipDetailsResponse
;
}
@Override
public
List
<
Equipment
>
findAll
()
{
return
iEquipmentDao
.
findAll
();
}
@Override
public
EquipCommunicationData
findFireEquipmentByPointCode
(
String
code
)
{
// EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
// if (ObjectUtils.isEmpty(data)) {
EquipCommunicationData
data
=
fireEquipMapper
.
findOneByPointCode
(
code
);
// }
return
data
;
}
@Override
public
EquipCommunicationData
findFireEquipDataByPointCode
(
String
code
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"pointCode"
).
is
(
code
)).
limit
(
1
);
query
.
with
(
new
Sort
(
new
Order
(
Direction
.
DESC
,
"recDate"
)));
query
.
limit
(
1
);
List
<
EquipCommunicationData
>
data
=
mongoTemplate
.
find
(
query
,
EquipCommunicationData
.
class
);
if
(
data
.
isEmpty
())
{
return
null
;
}
return
data
.
get
(
0
);
}
@Override
public
int
countImpEquipByIds
(
String
[]
idArray
)
{
return
equipmentFireEquipmentDao
.
countImpEquipByIds
(
idArray
);
}
@Override
public
int
countFemaRelation
(
String
[]
idArray
)
{
return
iEquipmentDao
.
countFemaRelation
(
idArray
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IEquipmentService.java
View file @
c46de4ff
...
...
@@ -97,8 +97,6 @@ public interface IEquipmentService {
*/
List
<
Equipment
>
findAll
();
void
findAllEquipPointInfo
();
EquipCommunicationData
findFireEquipmentByPointCode
(
String
code
);
EquipCommunicationData
findFireEquipDataByPointCode
(
String
code
);
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_equip.xml
View file @
c46de4ff
...
...
@@ -324,25 +324,6 @@
</where>
</select>
<select
id=
"findAllEquipPointInfo"
resultType=
"com.yeejoin.amos.fas.business.vo.EquipCommunicationData"
>
SELECT
p.`code` pointCode,
p.`name` pointName,
f.`name` equimentName,
f.id equimentId,
e.id fireEquipmentId,
e.`name` fireEquipmentName,
e.code fireEquipmentCode,
p.type,
d.dict_value alarmType,
p.unit
FROM
f_fire_equipment_point p
LEFT JOIN f_fire_equipment e ON e.id = p.fire_equipment_id
LEFT JOIN f_equipment_fire_equipment fe ON fe.fire_equipment_id = e.id
LEFT JOIN f_equipment f ON f.id = fe.equipment_id
LEFT JOIN f_dict d on d.id = p.alarm_type
</select>
<select
id=
"findOneByPointCode"
resultType=
"com.yeejoin.amos.fas.business.vo.EquipCommunicationData"
>
SELECT
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
View file @
c46de4ff
...
...
@@ -974,7 +974,6 @@
fe.is_indoor as inDoor,
case
when fe.equip_classify = 0 then CONCAT('monitorEquipment',fe.id)
when fe.equip_classify = 2 then CONCAT('video',fe.id)
when fe.equip_classify = 3 then CONCAT('fireEquipment',fe.id)
end as `key`,
fe.name,
...
...
@@ -1007,7 +1006,6 @@
fe.name as title,
case
when fe.equip_classify = 0 then 'monitorEquipment'
when fe.equip_classify = 2 then 'video'
when fe.equip_classify = 3 then 'fireEquipment'
end as type,
fe.org_code as orgCode,
...
...
@@ -1117,6 +1115,40 @@
where rs.id is not null
AND s.position3d != '' AND s.position3d is not null
UNION ALL
SELECT
wlv.CODE,
wlv.id,
'' AS inDoor,
CONCAT( 'video', wlv.id ) AS `key`,
wlv.NAME,
'' AS LEVEL,
'' AS levelStr,
'' AS objKey,
CONCAT(
'{"x":',
substring_index( wlv.position3d, ',', 1 ),
',"y":',
substring_index( substring_index( wlv.position3d, ',', - 2 ), ',', 1 ),
',"z":',
substring_index( wlv.position3d, ',', - 1 ),
'}'
)
as positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE AS `showInfo`,
wlv.NAME AS title,
'video' AS type,
wlv.org_code AS orgCode,
'' AS riskSourceId,
0 AS frequency,
FALSE AS twinkle
FROM
wl_video wlv
WHERE
wlv.position3d != ''
AND wlv.position3d IS NOT NULL
union all
select
w.code,
w.id,
...
...
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