Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
c403cf5a
Commit
c403cf5a
authored
May 21, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 设备平台-消防系统配置-系统分组接口开发
parent
3b807bba
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
415 additions
and
100 deletions
+415
-100
FireFightingSystemGroupEntity.java
...ipmanage/common/entity/FireFightingSystemGroupEntity.java
+1
-1
CoreEquipmentsDto.java
...join/equipmanage/common/entity/dto/CoreEquipmentsDto.java
+22
-0
FireFightingSystemGroupModalDto.java
...ge/common/entity/dto/FireFightingSystemGroupModalDto.java
+34
-0
SystemEquipmentsDto.java
...in/equipmanage/common/entity/dto/SystemEquipmentsDto.java
+24
-0
EquipCountBySystemVO.java
...in/equipmanage/common/entity/vo/EquipCountBySystemVO.java
+2
-0
FireFightingSystemController.java
.../equipmanage/controller/FireFightingSystemController.java
+30
-0
FireFightingSystemGroupController.java
...pmanage/controller/FireFightingSystemGroupController.java
+41
-20
EquipmentSpecificMapper.java
...m/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java
+2
-1
FireFightingSystemMapper.java
.../yeejoin/equipmanage/mapper/FireFightingSystemMapper.java
+2
-0
FireFightingSystemGroupService.java
...n/equipmanage/service/FireFightingSystemGroupService.java
+12
-3
IFireFightingSystemService.java
...ejoin/equipmanage/service/IFireFightingSystemService.java
+8
-0
FireFightingSystemGroupServiceImpl.java
...nage/service/impl/FireFightingSystemGroupServiceImpl.java
+151
-67
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+25
-1
EquipmentSpecificMapper.xml
...uip/src/main/resources/mapper/EquipmentSpecificMapper.xml
+30
-6
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+31
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/FireFightingSystemGroupEntity.java
View file @
c403cf5a
...
...
@@ -24,7 +24,7 @@ public class FireFightingSystemGroupEntity extends BaseEntity {
private
String
groupCode
;
@ApiModelProperty
(
value
=
"展示类型:0-系统部件 1-安措"
)
private
Integer
show
Type
;
private
Integer
display
Type
;
@ApiModelProperty
(
value
=
"系统ID"
)
private
String
systemIds
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/CoreEquipmentsDto.java
0 → 100644
View file @
c403cf5a
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
public
class
CoreEquipmentsDto
{
@ApiModelProperty
(
value
=
"装备ID"
)
private
String
id
;
@ApiModelProperty
(
value
=
"装备名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"装备排序"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"所属类型"
)
private
Integer
type
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/FireFightingSystemGroupModalDto.java
0 → 100644
View file @
c403cf5a
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
FireFightingSystemGroupModalDto
extends
BaseDTO
<
FireFightingSystemGroupEntity
>
{
@ApiModelProperty
(
value
=
"分组名称"
)
private
String
groupName
;
@ApiModelProperty
(
value
=
"展示类型:0-安措 1-保护区域"
)
private
Integer
displayType
;
@ApiModelProperty
(
value
=
"分组排序"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"系统装备列表"
)
private
List
<
SystemEquipmentsDto
>
systems
;
@ApiModelProperty
(
value
=
"业务组织编码"
)
private
String
bizOrgCode
;
@ApiModelProperty
(
value
=
"业务组织名称"
)
private
String
bizOrgName
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/SystemEquipmentsDto.java
0 → 100644
View file @
c403cf5a
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@Data
@Accessors
(
chain
=
true
)
public
class
SystemEquipmentsDto
{
@ApiModelProperty
(
value
=
"系统ID"
)
private
String
id
;
@ApiModelProperty
(
value
=
"系统名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"系统排序"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"装备列表"
)
private
List
<
CoreEquipmentsDto
>
equipments
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/EquipCountBySystemVO.java
View file @
c403cf5a
...
...
@@ -22,4 +22,6 @@ public class EquipCountBySystemVO {
private
Integer
equipmentNum
;
@ApiModelProperty
(
value
=
"单位"
)
private
String
unitName
;
@ApiModelProperty
(
value
=
"图标"
)
private
String
img
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemController.java
View file @
c403cf5a
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -132,6 +134,16 @@ public class FireFightingSystemController extends AbstractBaseController {
return
fireFightingSystemService
.
getEquipCountBySystemId
(
systemId
);
}
@RequestMapping
(
value
=
"/getEquipCountPageBySystemId"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
"根据系统id查询分组设备数量"
)
public
Page
<
EquipCountBySystemVO
>
getEquipCountPageBySystemId
(
@RequestParam
(
"systemId"
)
Long
systemId
,
@RequestParam
(
value
=
"pageNumber"
,
required
=
false
)
Integer
pageNumber
,
@RequestParam
(
value
=
"pageSize"
,
required
=
false
)
Integer
pageSize
)
{
return
fireFightingSystemService
.
getEquipCountPageBySystemId
(
systemId
,
pageNumber
,
pageSize
);
}
@RequestMapping
(
value
=
"/getOneById"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
"通过id查询消防系统信息"
)
...
...
@@ -855,6 +867,24 @@ public class FireFightingSystemController extends AbstractBaseController {
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"消防系统列表查询(不分页)"
,
notes
=
"下拉使用"
)
@GetMapping
(
value
=
"/systems"
)
public
List
<
FireFightingSystemEntity
>
systems
(
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
.
PersonIdentity
personIdentity
=
reginParams
.
getPersonIdentity
();
if
(!
ValidationUtil
.
isEmpty
(
personIdentity
))
{
bizOrgCode
=
personIdentity
.
getBizOrgCode
();
}
}
Wrapper
<
FireFightingSystemEntity
>
wrapper
=
Wrappers
.<
FireFightingSystemEntity
>
lambdaQuery
()
.
likeRight
(
FireFightingSystemEntity:
:
getBizOrgCode
,
bizOrgCode
)
.
isNotNull
(
FireFightingSystemEntity:
:
getName
)
.
isNotNull
(
FireFightingSystemEntity:
:
getSystemType
);
return
fireFightingSystemService
.
list
(
wrapper
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"消防系统树和消防建筑树"
,
notes
=
"树菜单"
)
@GetMapping
(
value
=
"/getBuildingTreeAndSystemTree"
)
public
Map
<
String
,
List
>
getBuildingTreeAndSystemTree
(
RequestBaseDto
dto
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemGroupController.java
View file @
c403cf5a
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity
;
import
com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.service.FireFightingSystemGroupService
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,49 +21,56 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Slf4j
@RestController
@Api
(
tags
=
"消防系统分组"
)
@RequestMapping
(
value
=
"/fire-fighting-system"
)
@RequestMapping
(
value
=
"/fire-fighting-system
-group
"
)
public
class
FireFightingSystemGroupController
extends
BaseController
{
@Autowired
private
FireFightingSystemGroupService
fireFightingSystemGroupService
;
@
PutMapping
(
value
=
"/save
"
)
@
ApiOperation
(
value
=
"消防系统列表查询(未绑定分组的系统)"
,
notes
=
"下拉使用
"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"添加分组"
,
notes
=
"添加分组"
)
public
ResponseModel
save
(
@RequestBody
FireFightingSystemGroupDto
dto
)
{
if
(!(
Objects
.
nonNull
(
dto
.
getGroupName
())
&&
Objects
.
nonNull
(
dto
.
getShowType
())
&&
Objects
.
nonNull
(
dto
.
getSystemIds
())
&&
!
dto
.
getSystemEquipmentRelations
().
isEmpty
()))
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
@GetMapping
(
value
=
"/systems"
)
public
ResponseModel
systems
(
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
.
PersonIdentity
personIdentity
=
reginParams
.
getPersonIdentity
();
if
(!
ValidationUtil
.
isEmpty
(
personIdentity
))
{
bizOrgCode
=
personIdentity
.
getBizOrgCode
();
}
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
dto
.
setBizOrgCode
(
reginParams
.
getCompany
().
getOrgCode
());
dto
.
setBizOrgCode
(
reginParams
.
getCompany
().
getCompanyName
());
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
saveOrUpdate
(
dto
));
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
selectUnboundSystems
(
bizOrgCode
));
}
@
PostMapping
(
value
=
"/update"
)
@
RequestMapping
(
value
=
"/save-or-update"
,
method
=
{
RequestMethod
.
PUT
,
RequestMethod
.
POST
}
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"P
OST"
,
value
=
"更新分组"
,
notes
=
"
更新分组"
)
public
ResponseModel
update
(
@RequestBody
FireFightingSystemGroup
Dto
dto
)
{
if
(!(
Objects
.
nonNull
(
dto
.
get
Id
())
&&
Objects
.
nonNull
(
dto
.
getGroupName
())
&&
Objects
.
nonNull
(
dto
.
getShowType
())
&&
Objects
.
nonNull
(
dto
.
getSystemIds
())
&&
!
dto
.
getSystemEquipmentRelations
().
isEmpty
(
)))
{
@ApiOperation
(
httpMethod
=
"P
UT"
,
value
=
"添加/更新分组"
,
notes
=
"添加/
更新分组"
)
public
ResponseModel
save
(
@RequestBody
FireFightingSystemGroupModal
Dto
dto
)
{
if
(!(
Objects
.
nonNull
(
dto
.
get
GroupName
())
&&
Objects
.
nonNull
(
dto
.
getDisplayType
())
&&
Objects
.
nonNull
(
dto
.
getSystems
()
)))
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
dto
.
setBizOrgCode
(
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
());
dto
.
setBizOrgName
(
reginParams
.
getPersonIdentity
().
getCompanyName
());
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
saveOrUpdate
(
dto
));
}
@P
os
tMapping
(
value
=
"/update-group-sort"
)
@P
u
tMapping
(
value
=
"/update-group-sort"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"P
OS
T"
,
value
=
"更新分组展示顺序"
,
notes
=
"更新分组展示顺序"
)
public
ResponseModel
updateGroupSort
(
@Request
Body
List
<
Long
>
groupIds
)
{
@ApiOperation
(
httpMethod
=
"P
U
T"
,
value
=
"更新分组展示顺序"
,
notes
=
"更新分组展示顺序"
)
public
ResponseModel
updateGroupSort
(
@Request
Param
(
"groupIds"
)
String
groupIds
)
{
if
(
Objects
.
isNull
(
groupIds
)
||
groupIds
.
isEmpty
())
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
}
fireFightingSystemGroupService
.
updateGroupSort
(
groupIds
);
List
<
Long
>
ids
=
Arrays
.
stream
(
groupIds
.
split
(
","
)).
map
(
Long:
:
valueOf
).
mapToLong
(
Long:
:
longValue
).
boxed
().
collect
(
Collectors
.
toList
());
fireFightingSystemGroupService
.
updateGroupSort
(
ids
);
return
CommonResponseUtil
.
success
();
}
...
...
@@ -78,8 +90,17 @@ public class FireFightingSystemGroupController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询分组列表"
,
notes
=
"查询分组列表"
)
public
ResponseModel
list
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
bizOrgCode
=
getOrgCode
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
bizOrgCode
=
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
();
}
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
listGroup
(
bizOrgCode
));
}
@DeleteMapping
(
value
=
"/{id}"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"删除分组"
,
notes
=
"删除分组"
)
public
ResponseModel
deteleGroup
(
@PathVariable
(
"id"
)
Long
id
)
{
fireFightingSystemGroupService
.
deleteGroup
(
id
);
return
CommonResponseUtil
.
success
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java
View file @
c403cf5a
...
...
@@ -29,7 +29,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
int
getEquipmentSpeCount
(
Map
<
String
,
Object
>
map
);
List
<
Map
<
String
,
Object
>>
getEquipment
Specific
Count
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getEquipmentCount
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
IPage
<
ComplementCodeVO
>
selectEquipmentSpecific
(
Page
page
,
EquipmentSpecificDTO
equipmentSpecificDTO
);
...
...
@@ -336,4 +336,5 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List
<
Map
<
String
,
Object
>>
selectZJEquipmentSpecificWWXByIds
(
String
bussIds
);
Integer
selectEquipmentCountBySystemId
(
@Param
(
"systemId"
)
Long
systemId
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemMapper.java
View file @
c403cf5a
...
...
@@ -53,6 +53,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
List
<
EquipCountBySystemVO
>
getEquipCountBySystemId
(
Long
systemId
);
Page
<
EquipCountBySystemVO
>
getEquipCountPageBySystemId
(
@Param
(
"page"
)
Page
<
Object
>
page
,
@Param
(
"systemId"
)
Long
systemId
);
/**
* 保存
*
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/FireFightingSystemGroupService.java
View file @
c403cf5a
...
...
@@ -2,19 +2,23 @@ package com.yeejoin.equipmanage.service;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity
;
import
com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto
;
import
java.util.List
;
public
interface
FireFightingSystemGroupService
extends
IService
<
FireFightingSystemGroupEntity
>
{
/**
* 获取未绑定分组的系统列表
*/
JSONArray
selectUnboundSystems
(
String
bizOrgCode
);
/**
* 保存分组
*
* @param fireFightingSystemGroupDto 分组信息
* @param fireFightingSystemGroup
Modal
Dto 分组信息
*/
Boolean
saveOrUpdate
(
FireFightingSystemGroup
Dto
fireFightingSystemGroup
Dto
);
Boolean
saveOrUpdate
(
FireFightingSystemGroup
ModalDto
fireFightingSystemGroupModal
Dto
);
/**
* 更新分组排序
...
...
@@ -33,4 +37,9 @@ public interface FireFightingSystemGroupService extends IService<FireFightingSys
* @return 分组列表
*/
JSONArray
listGroup
(
String
bizOrgCode
);
/**
* 删除分组
*/
void
deleteGroup
(
Long
groupId
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java
View file @
c403cf5a
...
...
@@ -60,6 +60,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List
<
EquipCountBySystemVO
>
getEquipCountBySystemId
(
Long
systemId
);
/**
* 根据系统id查询分组设备数量
*
* @param systemId
* @return
*/
Page
<
EquipCountBySystemVO
>
getEquipCountPageBySystemId
(
Long
systemId
,
Integer
pageNumber
,
Integer
pageSize
);
/**
* 保存
*
* @param vo
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemGroupServiceImpl.java
View file @
c403cf5a
...
...
@@ -2,19 +2,21 @@ package com.yeejoin.equipmanage.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.amos.component.robot.BadRequest
;
import
com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto
;
import
com.yeejoin.equipmanage.common.dto.SystemEquipmentRelationDto
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity
;
import
com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity
;
import
com.yeejoin.equipmanage.common.enums.SystemGroupShowTypeEnum
;
import
com.yeejoin.equipmanage.common.entity.dto.CoreEquipmentsDto
;
import
com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto
;
import
com.yeejoin.equipmanage.common.entity.dto.SystemEquipmentsDto
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper
;
import
com.yeejoin.equipmanage.mapper.FireFightingSystemGroupMapper
;
import
com.yeejoin.equipmanage.mapper.FireFightingSystemMapper
;
import
com.yeejoin.equipmanage.service.FireFightingSystemGroupService
;
import
com.yeejoin.equipmanage.service.IFireFightingSystemService
;
import
com.yeejoin.equipmanage.service.SystemEquipmentRelationService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,70 +37,113 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
private
FireFightingSystemMapper
fireFightingSystemMapper
;
@Autowired
private
EquipmentSpecificMapper
equipmentSpecificMapper
;
@Autowired
private
IFireFightingSystemService
fireFightingSystemService
;
/**
* 获取未绑定分组的系统列表
*
* @param bizOrgCode
*/
@Override
public
JSONArray
selectUnboundSystems
(
String
bizOrgCode
)
{
Wrapper
<
FireFightingSystemEntity
>
wrapper
=
Wrappers
.<
FireFightingSystemEntity
>
lambdaQuery
()
.
likeRight
(
FireFightingSystemEntity:
:
getBizOrgCode
,
bizOrgCode
)
.
isNotNull
(
FireFightingSystemEntity:
:
getName
)
.
isNotNull
(
FireFightingSystemEntity:
:
getSystemType
);
List
<
FireFightingSystemEntity
>
systems
=
fireFightingSystemService
.
list
(
wrapper
);
List
<
Long
>
systemIds
=
systems
.
stream
().
map
(
FireFightingSystemEntity:
:
getId
).
collect
(
Collectors
.
toList
());
if
(!
systemIds
.
isEmpty
())
{
List
<
FireFightingSystemGroupEntity
>
entities
=
this
.
list
();
List
<
String
>
list
=
entities
.
stream
().
map
(
FireFightingSystemGroupEntity:
:
getSystemIds
).
collect
(
Collectors
.
toList
());
List
<
Long
>
boundedSystemIds
=
list
.
stream
().
flatMap
(
s
->
Arrays
.
stream
(
s
.
split
(
","
))).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
systemIds
.
removeAll
(
boundedSystemIds
);
}
JSONArray
result
=
new
JSONArray
();
for
(
FireFightingSystemEntity
system
:
systems
)
{
Map
<
String
,
Object
>
jsonObject
=
new
HashMap
<>();
jsonObject
.
put
(
"id"
,
system
.
getId
());
jsonObject
.
put
(
"name"
,
system
.
getName
());
if
(!
systemIds
.
contains
(
system
.
getId
()))
{
jsonObject
.
put
(
"isBound"
,
true
);
}
else
{
jsonObject
.
put
(
"isBound"
,
false
);
}
result
.
add
(
jsonObject
);
}
return
result
;
}
/**
* 保存分组
*
* @param fireFightingSystemGroupDto 分组信息
* @param fireFightingSystemGroup
Modal
Dto 分组信息
* @return 分组信息
*/
@Override
@Transactional
public
Boolean
saveOrUpdate
(
FireFightingSystemGroup
Dto
fireFightingSystemGroup
Dto
)
{
if
(!(
Objects
.
nonNull
(
fireFightingSystemGroup
Dto
.
getGroupName
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getShowType
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getSystemIds
())
&&
!
fireFightingSystemGroupDto
.
getSystemEquipmentRelations
().
isEmpty
(
)))
{
public
Boolean
saveOrUpdate
(
FireFightingSystemGroup
ModalDto
fireFightingSystemGroupModal
Dto
)
{
if
(!(
Objects
.
nonNull
(
fireFightingSystemGroup
ModalDto
.
getGroupName
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupModalDto
.
getDisplayType
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupModalDto
.
getSystems
()
)))
{
throw
new
BadRequest
(
"无效参数!"
);
}
// 分组名称唯一性校验
Integer
count
=
fireFightingSystemGroupMapper
.
selectCount
(
Wrappers
.<
FireFightingSystemGroupEntity
>
lambdaQuery
()
.
eq
(
FireFightingSystemGroupEntity:
:
getGroupName
,
fireFightingSystemGroupDto
.
getGroupName
())
);
if
(
count
>
0
)
{
throw
new
BadRequest
(
"当前分组已存在!"
);
}
// 消防系统-部件校验
List
<
Long
>
systemIds
=
Arrays
.
stream
(
fireFightingSystemGroupDto
.
getSystemIds
().
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
SystemEquipmentRelationDto
>
systemEquipmentRelations
=
fireFightingSystemGroupDto
.
getSystemEquipmentRelations
();
List
<
SystemEquipmentRelationEntity
>
systemEquipmentRelationEntities
=
new
ArrayList
<>(
systemEquipmentRelations
.
size
());
for
(
Long
systemId
:
systemIds
)
{
if
(
systemEquipmentRelations
.
stream
().
noneMatch
(
systemEquipmentRelationDto
->
systemEquipmentRelationDto
.
getSystemId
().
equals
(
systemId
)))
{
throw
new
BadRequest
(
"当前系统-部件关系无效!"
);
}
count
=
fireFightingSystemGroupMapper
.
selectCount
(
if
(
Objects
.
isNull
(
fireFightingSystemGroupModalDto
.
getId
()))
{
Integer
count
=
fireFightingSystemGroupMapper
.
selectCount
(
Wrappers
.<
FireFightingSystemGroupEntity
>
lambdaQuery
()
.
like
(
FireFightingSystemGroupEntity:
:
getSystemIds
,
systemId
)
.
eq
(
FireFightingSystemGroupEntity:
:
getGroupName
,
fireFightingSystemGroupModalDto
.
getGroupName
()
)
);
if
(
count
>
0
)
{
throw
new
BadRequest
(
"当前
系统已分配在其他分组中,无法继续分组
!"
);
throw
new
BadRequest
(
"当前
分组已存在
!"
);
}
systemEquipmentRelations
.
stream
().
filter
(
relation
->
relation
.
getSystemId
().
equals
(
systemId
)).
findFirst
().
ifPresent
(
relation
->
{
SystemEquipmentRelationEntity
relationEntity
=
SystemEquipmentRelationEntity
.
builder
()
.
systemId
(
relation
.
getSystemId
())
.
equipmentId
(
relation
.
getEquipmentId
())
.
sort
(
Objects
.
nonNull
(
relation
.
getSort
())
?
relation
.
getSort
()
:
0
)
.
build
();
systemEquipmentRelationEntities
.
add
(
relationEntity
);
});
}
// 入库
// 更新时先删除系统-装备关系数据再入库
if
(
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getId
()))
{
List
<
SystemEquipmentsDto
>
systems
=
fireFightingSystemGroupModalDto
.
getSystems
();
// 更新数据前先清理解绑的系统与相关关系表的数据
if
(
Objects
.
nonNull
(
fireFightingSystemGroupModalDto
.
getId
()))
{
FireFightingSystemGroupEntity
entity
=
fireFightingSystemGroupMapper
.
selectById
(
fireFightingSystemGroupModalDto
.
getId
());
String
[]
systemIds
=
entity
.
getSystemIds
().
split
(
","
);
systemEquipmentRelationService
.
remove
(
Wrappers
.<
SystemEquipmentRelationEntity
>
lambdaQuery
()
.
in
(
SystemEquipmentRelationEntity:
:
getSystemId
,
systemIds
)
.
in
(
SystemEquipmentRelationEntity:
:
getSystemId
,
(
Object
)
systemIds
)
);
systemEquipmentRelationService
.
saveBatch
(
systemEquipmentRelationEntities
);
}
String
[]
sortedSystemIds
=
new
String
[
systems
.
size
()];
for
(
SystemEquipmentsDto
system
:
systems
)
{
// 系统重排序
sortedSystemIds
[
system
.
getSort
()]
=
system
.
getId
();
// 构建系统与装备关系
List
<
CoreEquipmentsDto
>
equipments
=
system
.
getEquipments
();
List
<
SystemEquipmentRelationEntity
>
relationEntities
=
equipments
.
stream
()
.
map
(
equipment
->
SystemEquipmentRelationEntity
.
builder
()
.
systemId
(
Long
.
valueOf
(
system
.
getId
()))
.
equipmentId
(
Long
.
valueOf
(
equipment
.
getId
()))
.
type
(
equipment
.
getType
())
.
sort
(
equipment
.
getSort
())
.
build
()
).
collect
(
Collectors
.
toList
());
if
(!
systemEquipmentRelationService
.
saveBatch
(
relationEntities
))
{
throw
new
BadRequest
(
"保存分组关系失败!"
);
}
}
// 分组信息入库
FireFightingSystemGroupEntity
fireFightingSystemGroupEntity
=
FireFightingSystemGroupEntity
.
builder
()
.
groupName
(
fireFightingSystemGroupDto
.
getGroupName
())
.
groupCode
(
System
.
currentTimeMillis
()
+
""
)
.
showType
(
fireFightingSystemGroupDto
.
getShow
Type
())
.
systemIds
(
fireFightingSystemGroupDto
.
getSystemIds
(
))
.
remarks
(
fireFightingSystemGroupDto
.
getRemarks
()
)
.
sort
(
Objects
.
nonNull
(
fireFightingSystemGroup
Dto
.
getSort
())
?
fireFightingSystemGroup
Dto
.
getSort
()
:
0
)
.
bizOrgName
(
fireFightingSystemGroup
Dto
.
getGroupCod
e
())
.
bizOrgCode
(
fireFightingSystemGroup
Dto
.
getBizOrgNam
e
())
.
groupName
(
fireFightingSystemGroup
Modal
Dto
.
getGroupName
())
.
groupCode
(
System
.
currentTimeMillis
()
+
""
)
// TODO
.
displayType
(
fireFightingSystemGroupModalDto
.
getDisplay
Type
())
.
systemIds
(
String
.
join
(
","
,
sortedSystemIds
))
.
remarks
(
""
)
.
sort
(
Objects
.
nonNull
(
fireFightingSystemGroup
ModalDto
.
getSort
())
?
fireFightingSystemGroupModal
Dto
.
getSort
()
:
0
)
.
bizOrgName
(
fireFightingSystemGroup
ModalDto
.
getBizOrgNam
e
())
.
bizOrgCode
(
fireFightingSystemGroup
ModalDto
.
getBizOrgCod
e
())
.
build
();
if
(
Objects
.
nonNull
(
fireFightingSystemGroupModalDto
.
getId
()))
{
fireFightingSystemGroupEntity
.
setId
(
Long
.
valueOf
(
fireFightingSystemGroupModalDto
.
getId
()));
}
return
this
.
saveOrUpdate
(
fireFightingSystemGroupEntity
);
}
...
...
@@ -114,9 +159,9 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
throw
new
BadRequest
(
"无效参数!"
);
}
Collection
<
FireFightingSystemGroupEntity
>
entities
=
this
.
listByIds
(
groupIds
);
int
sort
=
0
;
for
(
FireFightingSystemGroupEntity
entity
:
entities
)
{
entit
y
.
setSort
(++
sort
);
for
(
int
i
=
0
;
i
<
groupIds
.
size
();
i
++)
{
final
int
sort
=
i
;
entit
ies
.
stream
().
filter
(
entity
->
entity
.
getId
().
equals
(
groupIds
.
get
(
sort
))).
findFirst
().
ifPresent
(
entity
->
entity
.
setSort
(
sort
)
);
}
this
.
updateBatchById
(
entities
);
}
...
...
@@ -151,11 +196,12 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
public
JSONArray
listGroup
(
String
bizOrgCode
)
{
List
<
FireFightingSystemGroupEntity
>
groupEntities
=
fireFightingSystemGroupMapper
.
selectList
(
Wrappers
.<
FireFightingSystemGroupEntity
>
lambdaQuery
()
.
eq
(
FireFightingSystemGroupEntity:
:
getBizOrgCode
,
bizOrgCode
)
.
orderByAsc
(
FireFightingSystemGroupEntity:
:
getSort
)
.
likeRight
(
FireFightingSystemGroupEntity:
:
getBizOrgCode
,
bizOrgCode
)
.
orderByAsc
(
FireFightingSystemGroupEntity:
:
getSort
,
FireFightingSystemGroupEntity:
:
getCreateDate
)
);
List
<
Long
>
systemIds
=
groupEntities
.
stream
().
map
(
FireFightingSystemGroupEntity:
:
getSystemIds
).
map
(
s
->
s
.
split
(
","
)).
flatMap
(
Arrays:
:
stream
).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
// List to Map -> key: systemId, value: FireFightingSystemEntity
Map
<
Long
,
FireFightingSystemEntity
>
systemMap
=
fireFightingSystemMapper
.
selectList
(
Wrappers
.<
FireFightingSystemEntity
>
lambdaQuery
()
.
in
(
FireFightingSystemEntity:
:
getId
,
systemIds
)
...
...
@@ -163,6 +209,7 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
put
(
fireFightingSystemEntity
.
getId
(),
fireFightingSystemEntity
);
}}).
collect
(
Collectors
.
toMap
(
map
->
map
.
keySet
().
iterator
().
next
(),
map
->
map
.
values
().
iterator
().
next
()));
// List to Map -> key: equipmentId, value: List<SystemEquipmentRelationEntity>
Map
<
Long
,
List
<
SystemEquipmentRelationEntity
>>
systemEquipmentMap
=
new
HashMap
<>();
List
<
SystemEquipmentRelationEntity
>
systemEquipmentRelationEntities
=
systemEquipmentRelationService
.
list
(
Wrappers
.<
SystemEquipmentRelationEntity
>
lambdaQuery
()
...
...
@@ -178,45 +225,82 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
}
}
List
<
Map
<
String
,
Object
>>
equipmentSpecificCountList
=
equipmentSpecificMapper
.
getEquipmentSpecificCount
(
bizOrgCode
);
Map
<
Long
,
Map
<
String
,
Object
>>
equipmentCountMap
=
equipmentSpecificCountList
.
stream
().
map
(
map
->
new
HashMap
<
Long
,
Map
<
String
,
Object
>>()
{{
put
(
Long
.
valueOf
(
map
.
get
(
"id"
).
toString
()),
map
);
// List to Map -> key: equipmentId, value: 装备定义数量
List
<
Map
<
String
,
Object
>>
equipmentCountList
=
equipmentSpecificMapper
.
getEquipmentCount
(
bizOrgCode
);
Map
<
Long
,
Map
<
String
,
Object
>>
equipmentCountMap
=
equipmentCountList
.
stream
().
map
(
map
->
new
HashMap
<
Long
,
Map
<
String
,
Object
>>()
{{
put
(
Long
.
valueOf
(
map
.
get
(
"equipmentId"
).
toString
()),
map
);
}}).
collect
(
Collectors
.
toMap
(
map
->
map
.
keySet
().
iterator
().
next
(),
map
->
map
.
values
().
iterator
().
next
()));
JSONArray
groups
=
new
JSONArray
();
for
(
FireFightingSystemGroupEntity
groupEntity
:
groupEntities
)
{
JSONArray
group
=
new
JSONArray
();
JSONObject
group
=
new
JSONObject
();
JSONArray
systems
=
new
JSONArray
();
group
.
put
(
"id"
,
groupEntity
.
getId
());
group
.
put
(
"groupName"
,
groupEntity
.
getGroupName
());
group
.
put
(
"displayType"
,
groupEntity
.
getDisplayType
());
group
.
put
(
"sort"
,
groupEntity
.
getSort
());
group
.
put
(
"systems"
,
systems
);
List
<
Long
>
entitySystemIds
=
Arrays
.
stream
(
groupEntity
.
getSystemIds
().
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
for
(
Long
systemId
:
entitySystemIds
)
{
int
size
=
entitySystemIds
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Long
systemId
=
entitySystemIds
.
get
(
i
);
JSONObject
system
=
new
JSONObject
();
FireFightingSystemEntity
systemEntity
=
systemMap
.
get
(
systemId
);
List
<
SystemEquipmentRelationEntity
>
relationEntities
=
systemEquipmentMap
.
get
(
systemId
);
List
<
SystemEquipmentRelationEntity
>
relationEntities
=
Objects
.
nonNull
(
systemEquipmentMap
.
get
(
systemId
))
?
systemEquipmentMap
.
get
(
systemId
)
:
new
ArrayList
<>(
);
system
.
put
(
"id"
,
systemId
);
system
.
put
(
"code"
,
systemEntity
.
getCode
());
system
.
put
(
"typeCode"
,
systemEntity
.
getSystemTypeCode
());
system
.
put
(
"name"
,
systemEntity
.
getName
());
system
.
put
(
"systemState"
,
systemEntity
.
getSystemStatus
());
system
.
put
(
"systemRunState"
,
systemEntity
.
getSystemRunState
());
system
.
put
(
"protectObject"
,
systemEntity
.
getProObject
());
system
.
put
(
"systemDesc"
,
systemEntity
.
getSystemDescribe
());
system
.
put
(
"sort"
,
i
);
List
<
Map
<
String
,
Object
>>
systemEquipmentList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
securityMeasureList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
equipments
=
new
ArrayList
<>();
for
(
SystemEquipmentRelationEntity
relationEntity
:
relationEntities
)
{
Long
equipmentId
=
relationEntity
.
getEquipmentId
();
if
(
equipmentCountMap
.
containsKey
(
equipmentId
))
{
if
(
Objects
.
equals
(
SystemGroupShowTypeEnum
.
SYSTEM_EQUIPMENT
.
getCode
(),
relationEntity
.
getType
()))
{
systemEquipmentList
.
add
(
equipmentCountMap
.
get
(
equipmentId
));
}
if
(
Objects
.
equals
(
SystemGroupShowTypeEnum
.
SECURITY_MEASURE
.
getCode
(),
relationEntity
.
getType
()))
{
securityMeasureList
.
add
(
equipmentCountMap
.
get
(
equipmentId
));
}
Map
<
String
,
Object
>
equipmentMap
=
equipmentCountMap
.
get
(
equipmentId
);
Map
<
String
,
Object
>
equipment
=
new
HashMap
<>();
equipment
.
put
(
"id"
,
equipmentMap
.
get
(
"equipmentId"
));
equipment
.
put
(
"name"
,
equipmentMap
.
get
(
"equipmentName"
));
equipment
.
put
(
"num"
,
Integer
.
valueOf
(
equipmentMap
.
getOrDefault
(
"count"
,
"0"
).
toString
()));
equipment
.
put
(
"unit"
,
equipmentMap
.
get
(
"unit"
));
equipment
.
put
(
"sort"
,
relationEntity
.
getSort
());
equipment
.
put
(
"type"
,
relationEntity
.
getType
());
equipments
.
add
(
equipment
);
}
}
system
.
put
(
"systemEquipment"
,
systemEquipmentList
);
system
.
put
(
"securityMeasure"
,
securityMeasureList
);
group
.
add
(
system
);
system
.
put
(
"equipments"
,
equipments
);
systems
.
add
(
system
);
}
groups
.
add
(
group
);
}
return
groups
;
}
/**
* 删除分组
*
* @param groupId
*/
@Override
@Transactional
public
void
deleteGroup
(
Long
groupId
)
{
FireFightingSystemGroupEntity
groupEntity
=
fireFightingSystemGroupMapper
.
selectById
(
groupId
);
if
(
Objects
.
isNull
(
groupEntity
))
{
throw
new
BadRequest
(
"分组不存在"
);
}
String
systemIds
=
groupEntity
.
getSystemIds
();
List
<
Long
>
systemIdList
=
Arrays
.
stream
(
systemIds
.
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
// 删除映射关系
systemEquipmentRelationService
.
remove
(
Wrappers
.<
SystemEquipmentRelationEntity
>
lambdaQuery
()
.
in
(!
systemIdList
.
isEmpty
(),
SystemEquipmentRelationEntity:
:
getSystemId
,
systemIdList
)
);
// 删除分组
fireFightingSystemGroupMapper
.
deleteById
(
groupId
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
c403cf5a
...
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.base.Joiner
;
...
...
@@ -63,6 +64,7 @@ import java.net.NetworkInterface;
import
java.net.SocketException
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -94,6 +96,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
EquipmentSpecificAlarmMapper
equipmentSpecificAlarmMapper
;
@Autowired
EquipmentSpecificAlarmLogMapper
equipmentSpecificAlarmLogMapper
;
@Autowired
private
SourceSceneMapper
sourceSceneMapper
;
@Value
(
"${equipment.fire.systemid}"
)
private
String
fireSystemId
;
...
...
@@ -182,6 +186,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public
Page
<
EquipCountBySystemVO
>
getEquipCountPageBySystemId
(
Long
systemId
,
Integer
pageNumber
,
Integer
pageSize
)
{
return
this
.
baseMapper
.
getEquipCountPageBySystemId
(
new
Page
(
pageNumber
,
pageSize
),
systemId
);
}
@Override
public
List
<
EquiplistSpecificBySystemVO
>
getEquiplistBySystemId
(
Long
systemId
)
{
return
this
.
baseMapper
.
getEquiplistBySystemId
(
systemId
);
...
...
@@ -1114,7 +1124,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public
List
<
AlarmDataVO
>
getSystemById
(
Long
id
)
{
return
this
.
baseMapper
.
getSystemById
(
id
);
List
<
AlarmDataVO
>
list
=
this
.
baseMapper
.
getSystemById
(
id
);
// 部件总数
Integer
equipmentCount
=
equipmentSpecificMapper
.
selectCount
(
Wrappers
.<
EquipmentSpecific
>
lambdaQuery
().
eq
(
EquipmentSpecific:
:
getSystemId
,
id
)
);
// 今日报警次数
Integer
alarmCount
=
equipmentSpecificAlarmLogMapper
.
selectCount
(
Wrappers
.<
EquipmentSpecificAlarmLog
>
lambdaQuery
()
.
like
(
EquipmentSpecificAlarmLog:
:
getSystemIds
,
id
)
.
eq
(
EquipmentSpecificAlarmLog:
:
getStatus
,
"1"
)
.
likeRight
(
EquipmentSpecificAlarmLog:
:
getCreateDate
,
LocalDate
.
now
().
toString
())
);
list
.
add
(
new
AlarmDataVO
(
"部件总数"
,
equipmentCount
+
" 个"
,
false
));
list
.
add
(
new
AlarmDataVO
(
"今日报警次数"
,
alarmCount
+
" 次"
,
false
));
return
list
;
}
@Override
...
...
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificMapper.xml
View file @
c403cf5a
...
...
@@ -109,18 +109,21 @@
AND code like CONCAT('%',#{code},'%')
</if>
</select>
<select
id=
"getEquipment
Specific
Count"
resultType=
"Map"
>
<select
id=
"getEquipmentCount"
resultType=
"Map"
>
SELECT
we.id as id,
we.name as equipmentName,
count(1) as count
we.id AS equipmentId,
we.name AS equipmentName,
count(1) AS count,
u.name AS unit
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail wsd ON wesp.equipment_detail_id = wsd.id
LEFT JOIN wl_equipment we ON wsd.equipment_id = we.id
LEFT JOIN wl_unit u on u.id = we.unit_id
<where>
we.id IS NOT NULL
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND wesp.biz_org_code
=
concat(#{bizOrgCode},'%')
AND wesp.biz_org_code
like
concat(#{bizOrgCode},'%')
</if>
</where>
GROUP BY
...
...
@@ -2898,6 +2901,26 @@
</if>
</select>
<select
id=
"selectEquipmentCountBySystemId"
resultType=
"int"
>
SELECT
es.id,
es.name,
es.biz_org_name bizOrgName,
es.code,
es.position,
ed.standard,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND e.expiry_date IS NOT NULL
<if
test=
"bussIds != null and bussIds != ''"
>
And find_in_set(es.id, #{bussIds}) > 0
</if>
</select>
</mapper>
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
c403cf5a
...
...
@@ -14,6 +14,7 @@
<result
property=
"equipmentName"
column=
"equipment_name"
></result>
<result
property=
"equipmentNum"
column=
"num"
></result>
<result
property=
"unitName"
column=
"unit_name"
></result>
<result
property=
"img"
column=
"img"
></result>
</resultMap>
<resultMap
id=
"CategoryAmountList"
type=
"com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO"
>
<result
column=
"id"
property=
"id"
></result>
...
...
@@ -98,6 +99,7 @@
det.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
...
...
@@ -109,6 +111,24 @@
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
</select>
<select
id=
"getEquipCountPageBySystemId"
resultMap=
"EquipCountBySystemId"
>
SELECT
wle.id equipment_id,
det.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
where
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
</select>
<insert
id=
"save"
>
INSERT INTO
f_fire_fighting_system
...
...
@@ -719,7 +739,17 @@
f_fire_fighting_system fffs
LEFT JOIN wl_equipment_category wlec ON fffs.system_type = wlec.id
left join wl_manufacturer_info wlmi on wlmi.id=fffs.maintenance_unit
left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit) a where a.id=#{id} order by sort
left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit
UNION ALL
SELECT
fffs.id,
'保护区域' AS `key`,
pro_object AS value,
false as isHref,
9 as sort
FROM
f_fire_fighting_system fffs
) a where a.id=#{id} order by sort
</select>
<select
id=
"getEquipmentAlarmBySystemIdOrSourceIdVO"
resultType=
"com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO"
>
...
...
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