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
3b807bba
Commit
3b807bba
authored
May 17, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 设备平台-消防系统配置-系统分组接口开发
parent
07cd621a
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
570 additions
and
0 deletions
+570
-0
FireFightingSystemGroupDto.java
...in/equipmanage/common/dto/FireFightingSystemGroupDto.java
+43
-0
SystemEquipmentRelationDto.java
...in/equipmanage/common/dto/SystemEquipmentRelationDto.java
+26
-0
FireFightingSystemGroupEntity.java
...ipmanage/common/entity/FireFightingSystemGroupEntity.java
+43
-0
SystemEquipmentRelationEntity.java
...ipmanage/common/entity/SystemEquipmentRelationEntity.java
+31
-0
SystemGroupShowTypeEnum.java
...oin/equipmanage/common/enums/SystemGroupShowTypeEnum.java
+29
-0
FireFightingSystemGroupController.java
...pmanage/controller/FireFightingSystemGroupController.java
+85
-0
EquipmentSpecificMapper.java
...m/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java
+2
-0
FireFightingSystemGroupMapper.java
...oin/equipmanage/mapper/FireFightingSystemGroupMapper.java
+9
-0
SystemEquipmentRelationMapper.java
...oin/equipmanage/mapper/SystemEquipmentRelationMapper.java
+9
-0
FireFightingSystemGroupService.java
...n/equipmanage/service/FireFightingSystemGroupService.java
+36
-0
SystemEquipmentRelationService.java
...n/equipmanage/service/SystemEquipmentRelationService.java
+7
-0
FireFightingSystemGroupServiceImpl.java
...nage/service/impl/FireFightingSystemGroupServiceImpl.java
+222
-0
SystemEquipmentRelationServiceImpl.java
...nage/service/impl/SystemEquipmentRelationServiceImpl.java
+11
-0
EquipmentSpecificMapper.xml
...uip/src/main/resources/mapper/EquipmentSpecificMapper.xml
+17
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/dto/FireFightingSystemGroupDto.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
common
.
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
FireFightingSystemGroupDto
extends
BaseDTO
<
FireFightingSystemGroupEntity
>
{
@ApiModelProperty
(
value
=
"分组名称"
)
private
String
groupName
;
@ApiModelProperty
(
value
=
"分组编码"
)
private
String
groupCode
;
@ApiModelProperty
(
value
=
"展示类型:0-系统部件 1-安措"
)
private
Integer
showType
;
@ApiModelProperty
(
value
=
"系统ID"
)
private
String
systemIds
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remarks
;
@ApiModelProperty
(
value
=
"分组排序"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"业务组织编码"
)
private
String
bizOrgCode
;
@ApiModelProperty
(
value
=
"业务组织名称"
)
private
String
bizOrgName
;
@ApiModelProperty
(
value
=
"系统与系统部件"
)
private
List
<
SystemEquipmentRelationDto
>
systemEquipmentRelations
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/dto/SystemEquipmentRelationDto.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
common
.
dto
;
import
com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
SystemEquipmentRelationDto
extends
BaseDTO
<
SystemEquipmentRelationEntity
>
{
@ApiModelProperty
(
value
=
"系统ID"
)
private
Long
systemId
;
@ApiModelProperty
(
value
=
"分组编码"
)
private
Long
equipmentId
;
@ApiModelProperty
(
value
=
"类型(0:系统部件、1:安措)"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"部件排序"
)
private
Integer
sort
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/FireFightingSystemGroupEntity.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@Builder
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"f_fire_fighting_system_group"
)
@ApiModel
(
value
=
"f_fire_fighting_system_group"
,
description
=
"消防系统分组"
)
public
class
FireFightingSystemGroupEntity
extends
BaseEntity
{
@ApiModelProperty
(
value
=
"分组名称"
)
private
String
groupName
;
@ApiModelProperty
(
value
=
"分组编码"
)
private
String
groupCode
;
@ApiModelProperty
(
value
=
"展示类型:0-系统部件 1-安措"
)
private
Integer
showType
;
@ApiModelProperty
(
value
=
"系统ID"
)
private
String
systemIds
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remarks
;
@ApiModelProperty
(
value
=
"分组排序"
)
private
Integer
sort
;
@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/SystemEquipmentRelationEntity.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@Builder
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"f_system_equipment_relation"
)
@ApiModel
(
value
=
"f_system_equipment_relation"
,
description
=
"消防系统部件关系"
)
public
class
SystemEquipmentRelationEntity
extends
BaseEntity
{
@ApiModelProperty
(
value
=
"系统ID"
)
private
Long
systemId
;
@ApiModelProperty
(
value
=
"分组编码"
)
private
Long
equipmentId
;
@ApiModelProperty
(
value
=
"类型(0:系统部件、1:安措)"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"部件排序"
)
private
Integer
sort
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/SystemGroupShowTypeEnum.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Objects
;
@Getter
@AllArgsConstructor
public
enum
SystemGroupShowTypeEnum
{
SYSTEM_EQUIPMENT
(
0
,
"系统部件"
),
SECURITY_MEASURE
(
1
,
"安措"
);
private
final
Integer
code
;
private
final
String
value
;
public
static
SystemGroupShowTypeEnum
getEnumByCode
(
Integer
code
)
{
SystemGroupShowTypeEnum
aEnum
=
null
;
for
(
SystemGroupShowTypeEnum
item
:
SystemGroupShowTypeEnum
.
values
())
{
if
(
Objects
.
equals
(
item
.
getCode
(),
code
))
{
aEnum
=
item
;
break
;
}
}
return
aEnum
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemGroupController.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
controller
;
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.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.service.FireFightingSystemGroupService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
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.List
;
import
java.util.Objects
;
@Slf4j
@RestController
@Api
(
tags
=
"消防系统分组"
)
@RequestMapping
(
value
=
"/fire-fighting-system"
)
public
class
FireFightingSystemGroupController
extends
BaseController
{
@Autowired
private
FireFightingSystemGroupService
fireFightingSystemGroupService
;
@PutMapping
(
value
=
"/save"
)
@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
(
"非法参数"
);
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
dto
.
setBizOrgCode
(
reginParams
.
getCompany
().
getOrgCode
());
dto
.
setBizOrgCode
(
reginParams
.
getCompany
().
getCompanyName
());
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
saveOrUpdate
(
dto
));
}
@PostMapping
(
value
=
"/update"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"更新分组"
,
notes
=
"更新分组"
)
public
ResponseModel
update
(
@RequestBody
FireFightingSystemGroupDto
dto
)
{
if
(!(
Objects
.
nonNull
(
dto
.
getId
())
&&
Objects
.
nonNull
(
dto
.
getGroupName
())
&&
Objects
.
nonNull
(
dto
.
getShowType
())
&&
Objects
.
nonNull
(
dto
.
getSystemIds
())
&&
!
dto
.
getSystemEquipmentRelations
().
isEmpty
()))
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
}
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
saveOrUpdate
(
dto
));
}
@PostMapping
(
value
=
"/update-group-sort"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"更新分组展示顺序"
,
notes
=
"更新分组展示顺序"
)
public
ResponseModel
updateGroupSort
(
@RequestBody
List
<
Long
>
groupIds
)
{
if
(
Objects
.
isNull
(
groupIds
)
||
groupIds
.
isEmpty
())
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
}
fireFightingSystemGroupService
.
updateGroupSort
(
groupIds
);
return
CommonResponseUtil
.
success
();
}
@PostMapping
(
value
=
"/update-system-sort/{groupId}"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"更新系统展示顺序"
,
notes
=
"更新系统展示顺序"
)
public
ResponseModel
updateSystemSort
(
@PathVariable
Long
groupId
,
@RequestBody
List
<
Long
>
systemIds
)
{
if
(
Objects
.
isNull
(
systemIds
)
||
systemIds
.
isEmpty
())
{
return
CommonResponseUtil
.
failure
(
"非法参数"
);
}
fireFightingSystemGroupService
.
updateSystemSort
(
groupId
,
systemIds
);
return
CommonResponseUtil
.
success
();
}
@GetMapping
(
value
=
"/list"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询分组列表"
,
notes
=
"查询分组列表"
)
public
ResponseModel
list
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
bizOrgCode
=
getOrgCode
();
}
return
CommonResponseUtil
.
success
(
fireFightingSystemGroupService
.
listGroup
(
bizOrgCode
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java
View file @
3b807bba
...
...
@@ -29,6 +29,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
int
getEquipmentSpeCount
(
Map
<
String
,
Object
>
map
);
List
<
Map
<
String
,
Object
>>
getEquipmentSpecificCount
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
IPage
<
ComplementCodeVO
>
selectEquipmentSpecific
(
Page
page
,
EquipmentSpecificDTO
equipmentSpecificDTO
);
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemGroupMapper.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
FireFightingSystemGroupMapper
extends
BaseMapper
<
FireFightingSystemGroupEntity
>
{
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/SystemEquipmentRelationMapper.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
SystemEquipmentRelationMapper
extends
BaseMapper
<
SystemEquipmentRelationEntity
>
{
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/FireFightingSystemGroupService.java
0 → 100644
View file @
3b807bba
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
java.util.List
;
public
interface
FireFightingSystemGroupService
extends
IService
<
FireFightingSystemGroupEntity
>
{
/**
* 保存分组
*
* @param fireFightingSystemGroupDto 分组信息
*/
Boolean
saveOrUpdate
(
FireFightingSystemGroupDto
fireFightingSystemGroupDto
);
/**
* 更新分组排序
*/
void
updateGroupSort
(
List
<
Long
>
groupIds
);
/**
* 更新系统排序
*/
void
updateSystemSort
(
Long
groupId
,
List
<
Long
>
systemIds
);
/**
* 获取分组
*
* @param bizOrgCode 业务组织编码
* @return 分组列表
*/
JSONArray
listGroup
(
String
bizOrgCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/SystemEquipmentRelationService.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity
;
public
interface
SystemEquipmentRelationService
extends
IService
<
SystemEquipmentRelationEntity
>
{
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemGroupServiceImpl.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
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.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.SystemEquipmentRelationService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
FireFightingSystemGroupServiceImpl
extends
ServiceImpl
<
FireFightingSystemGroupMapper
,
FireFightingSystemGroupEntity
>
implements
FireFightingSystemGroupService
{
@Autowired
private
FireFightingSystemGroupMapper
fireFightingSystemGroupMapper
;
@Autowired
private
SystemEquipmentRelationService
systemEquipmentRelationService
;
@Autowired
private
FireFightingSystemMapper
fireFightingSystemMapper
;
@Autowired
private
EquipmentSpecificMapper
equipmentSpecificMapper
;
/**
* 保存分组
*
* @param fireFightingSystemGroupDto 分组信息
* @return 分组信息
*/
@Override
@Transactional
public
Boolean
saveOrUpdate
(
FireFightingSystemGroupDto
fireFightingSystemGroupDto
)
{
if
(!(
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getGroupName
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getShowType
())
&&
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getSystemIds
())
&&
!
fireFightingSystemGroupDto
.
getSystemEquipmentRelations
().
isEmpty
()))
{
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
(
Wrappers
.<
FireFightingSystemGroupEntity
>
lambdaQuery
()
.
like
(
FireFightingSystemGroupEntity:
:
getSystemIds
,
systemId
)
);
if
(
count
>
0
)
{
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
()))
{
systemEquipmentRelationService
.
remove
(
Wrappers
.<
SystemEquipmentRelationEntity
>
lambdaQuery
()
.
in
(
SystemEquipmentRelationEntity:
:
getSystemId
,
systemIds
)
);
systemEquipmentRelationService
.
saveBatch
(
systemEquipmentRelationEntities
);
}
FireFightingSystemGroupEntity
fireFightingSystemGroupEntity
=
FireFightingSystemGroupEntity
.
builder
()
.
groupName
(
fireFightingSystemGroupDto
.
getGroupName
())
.
groupCode
(
System
.
currentTimeMillis
()
+
""
)
.
showType
(
fireFightingSystemGroupDto
.
getShowType
())
.
systemIds
(
fireFightingSystemGroupDto
.
getSystemIds
())
.
remarks
(
fireFightingSystemGroupDto
.
getRemarks
())
.
sort
(
Objects
.
nonNull
(
fireFightingSystemGroupDto
.
getSort
())
?
fireFightingSystemGroupDto
.
getSort
()
:
0
)
.
bizOrgName
(
fireFightingSystemGroupDto
.
getGroupCode
())
.
bizOrgCode
(
fireFightingSystemGroupDto
.
getBizOrgName
())
.
build
();
return
this
.
saveOrUpdate
(
fireFightingSystemGroupEntity
);
}
/**
* 更新分组排序
*
* @param groupIds 分组ID
*/
@Override
@Transactional
public
void
updateGroupSort
(
List
<
Long
>
groupIds
)
{
if
(
Objects
.
isNull
(
groupIds
)
||
groupIds
.
isEmpty
())
{
throw
new
BadRequest
(
"无效参数!"
);
}
Collection
<
FireFightingSystemGroupEntity
>
entities
=
this
.
listByIds
(
groupIds
);
int
sort
=
0
;
for
(
FireFightingSystemGroupEntity
entity
:
entities
)
{
entity
.
setSort
(++
sort
);
}
this
.
updateBatchById
(
entities
);
}
/**
* 更新系统排序
*
* @param groupId 分组ID
* @param systemIds 系统ID
*/
@Override
public
void
updateSystemSort
(
Long
groupId
,
List
<
Long
>
systemIds
)
{
if
(
Objects
.
isNull
(
groupId
)
||
Objects
.
isNull
(
systemIds
))
{
throw
new
BadRequest
(
"无效参数!"
);
}
FireFightingSystemGroupEntity
entity
=
this
.
getById
(
groupId
);
if
(
Objects
.
isNull
(
entity
))
{
throw
new
BadRequest
(
"分组不存在!"
);
}
String
systemIdsStr
=
systemIds
.
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
));
entity
.
setSystemIds
(
systemIdsStr
);
this
.
updateById
(
entity
);
}
/**
* 获取分组
*
* @param bizOrgCode 业务组织编码
* @return 分组列表
*/
@Override
public
JSONArray
listGroup
(
String
bizOrgCode
)
{
List
<
FireFightingSystemGroupEntity
>
groupEntities
=
fireFightingSystemGroupMapper
.
selectList
(
Wrappers
.<
FireFightingSystemGroupEntity
>
lambdaQuery
()
.
eq
(
FireFightingSystemGroupEntity:
:
getBizOrgCode
,
bizOrgCode
)
.
orderByAsc
(
FireFightingSystemGroupEntity:
:
getSort
)
);
List
<
Long
>
systemIds
=
groupEntities
.
stream
().
map
(
FireFightingSystemGroupEntity:
:
getSystemIds
).
map
(
s
->
s
.
split
(
","
)).
flatMap
(
Arrays:
:
stream
).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
FireFightingSystemEntity
>
systemMap
=
fireFightingSystemMapper
.
selectList
(
Wrappers
.<
FireFightingSystemEntity
>
lambdaQuery
()
.
in
(
FireFightingSystemEntity:
:
getId
,
systemIds
)
).
stream
().
map
(
fireFightingSystemEntity
->
new
HashMap
<
Long
,
FireFightingSystemEntity
>()
{{
put
(
fireFightingSystemEntity
.
getId
(),
fireFightingSystemEntity
);
}}).
collect
(
Collectors
.
toMap
(
map
->
map
.
keySet
().
iterator
().
next
(),
map
->
map
.
values
().
iterator
().
next
()));
Map
<
Long
,
List
<
SystemEquipmentRelationEntity
>>
systemEquipmentMap
=
new
HashMap
<>();
List
<
SystemEquipmentRelationEntity
>
systemEquipmentRelationEntities
=
systemEquipmentRelationService
.
list
(
Wrappers
.<
SystemEquipmentRelationEntity
>
lambdaQuery
()
.
in
(
SystemEquipmentRelationEntity:
:
getSystemId
,
systemIds
)
);
for
(
SystemEquipmentRelationEntity
systemEquipmentRelation
:
systemEquipmentRelationEntities
)
{
if
(
systemEquipmentMap
.
containsKey
(
systemEquipmentRelation
.
getSystemId
()))
{
systemEquipmentMap
.
get
(
systemEquipmentRelation
.
getSystemId
()).
add
(
systemEquipmentRelation
);
}
else
{
List
<
SystemEquipmentRelationEntity
>
list
=
new
ArrayList
<>();
list
.
add
(
systemEquipmentRelation
);
systemEquipmentMap
.
put
(
systemEquipmentRelation
.
getSystemId
(),
list
);
}
}
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
);
}}).
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
();
List
<
Long
>
entitySystemIds
=
Arrays
.
stream
(
groupEntity
.
getSystemIds
().
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
for
(
Long
systemId
:
entitySystemIds
)
{
JSONObject
system
=
new
JSONObject
();
FireFightingSystemEntity
systemEntity
=
systemMap
.
get
(
systemId
);
List
<
SystemEquipmentRelationEntity
>
relationEntities
=
systemEquipmentMap
.
get
(
systemId
);
system
.
put
(
"id"
,
systemId
);
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
());
List
<
Map
<
String
,
Object
>>
systemEquipmentList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
securityMeasureList
=
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
));
}
}
}
system
.
put
(
"systemEquipment"
,
systemEquipmentList
);
system
.
put
(
"securityMeasure"
,
securityMeasureList
);
group
.
add
(
system
);
}
groups
.
add
(
group
);
}
return
groups
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SystemEquipmentRelationServiceImpl.java
0 → 100644
View file @
3b807bba
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity
;
import
com.yeejoin.equipmanage.mapper.SystemEquipmentRelationMapper
;
import
com.yeejoin.equipmanage.service.SystemEquipmentRelationService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
SystemEquipmentRelationServiceImpl
extends
ServiceImpl
<
SystemEquipmentRelationMapper
,
SystemEquipmentRelationEntity
>
implements
SystemEquipmentRelationService
{
}
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificMapper.xml
View file @
3b807bba
...
...
@@ -109,6 +109,23 @@
AND code like CONCAT('%',#{code},'%')
</if>
</select>
<select
id=
"getEquipmentSpecificCount"
resultType=
"Map"
>
SELECT
we.id as id,
we.name as equipmentName,
count(1) as count
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
<where>
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND wesp.biz_org_code = concat(#{bizOrgCode},'%')
</if>
</where>
GROUP BY
we.code
</select>
<select
id=
"selectEquipmentSpecific"
resultMap=
"ComplementCode"
>
SELECT
wesp.id 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