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
3049edbf
Commit
3049edbf
authored
Nov 05, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reafact(jg): 批量删除
1.设备批量删除 2.装置批量删除
parent
3ac60aac
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
211 additions
and
15 deletions
+211
-15
CommonMapper.java
.../yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
+8
-0
CommonMapper.xml
...-module-jg-api/src/main/resources/mapper/CommonMapper.xml
+58
-0
DataSourceConfiguration.java
...os/boot/module/jg/biz/config/DataSourceConfiguration.java
+1
-0
IdxBizJgProjectContraptionController.java
.../biz/controller/IdxBizJgProjectContraptionController.java
+14
-0
IdxBizJgProjectContraptionServiceImplService.java
...ce/impl/IdxBizJgProjectContraptionServiceImplService.java
+58
-2
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+25
-13
IdxBizJgProjectContraptionMapper.java
...dule/ymt/api/mapper/IdxBizJgProjectContraptionMapper.java
+11
-0
IdxBizJgProjectContraptionMapper.xml
...ain/resources/mapper/IdxBizJgProjectContraptionMapper.xml
+36
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
View file @
3049edbf
...
...
@@ -81,6 +81,14 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
Integer
countEquipInUseTimesWithOutZF
(
String
record
);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外)
*
* @param records 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
List
<
CountDto
>
countEquipInUseTimesWithOutZFBatch
(
@Param
(
"records"
)
List
<
String
>
records
);
/**
* 查询使该设备变为已纳管的业务的数量 [> 0,则纳管状态不需要更新][< 0,则纳管状态需要更新]
* @param record 设备唯一标识
* @return 使设备变为已纳管设备的的业务数量
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/CommonMapper.xml
View file @
3049edbf
...
...
@@ -3329,4 +3329,62 @@
equ_id = #{record} and change_content = '设备编辑'
) a
</select>
<select
id=
"countEquipInUseTimesWithOutZFBatch"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
select
sum(inUseNumber) longValue,
record as keyStr
from (
select
count(1) as inUseNumber,
b.equ_id AS record
from
tzs_jg_use_registration a,
tzs_jg_use_registration_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = ANY(ARRAY[
<foreach
collection=
"records"
item=
"record"
separator=
","
>
#{record}
</foreach>
])
and a.is_delete = 0
and ( a.status
<![CDATA[ <> ]]>
'已作废')
GROUP BY b.equ_id
UNION ALL
select
count(1) as inUseNumber,
b.equ_id AS record
from
tzs_jg_installation_notice a,
tzs_jg_installation_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = ANY(ARRAY[
<foreach
collection=
"records"
item=
"record"
separator=
","
>
#{record}
</foreach>
])
and a.is_delete = 0
and (a.notice_status
<![CDATA[ <> ]]>
'6617')
GROUP BY b.equ_id
UNION ALL
select
count(1) as inUseNumber,
b.equ_id AS record
from
tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where
a.sequence_nbr = b.vehicle_id
and b.equ_id = ANY(ARRAY[
<foreach
collection=
"records"
item=
"record"
separator=
","
>
#{record}
</foreach>
])
and a.is_delete = 0
and (a.status
<![CDATA[ <> ]]>
'已作废')
GROUP BY b.equ_id
)
GROUP BY record
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/config/DataSourceConfiguration.java
View file @
3049edbf
...
...
@@ -40,6 +40,7 @@ public class DataSourceConfiguration {
dataSource
.
setConnectionTimeout
(
hikariDataSourceProperties
.
getConnectionTimeout
());
dataSource
.
setIdleTimeout
(
hikariDataSourceProperties
.
getIdleTimeout
());
dataSource
.
setConnectionInitSql
(
hikariDataSourceProperties
.
getConnectionInitSql
());
dataSource
.
setRegisterMbeans
(
hikariDataSourceProperties
.
getRegisterMbeans
());
return
new
DataSourceProxy
(
dataSource
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/IdxBizJgProjectContraptionController.java
View file @
3049edbf
...
...
@@ -69,6 +69,20 @@ public class IdxBizJgProjectContraptionController extends BaseController {
}
/**
* 根据sequenceNbr删除
*
* @param map 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/delete-batch"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr删除管道工程装置表及设备信息"
,
notes
=
"根据sequenceNbr删除管道工程装置表及设备信息"
)
public
ResponseModel
<
Boolean
>
deleteBatch
(
@RequestBody
JSONObject
map
)
{
List
<
String
>
ids
=
(
List
<
String
>)
map
.
get
(
"ids"
);
return
ResponseHelper
.
buildResponse
(
idxBizJgProjectContraptionServiceImpl
.
deleteProjectAndEquInfoBatch
(
ids
));
}
/**
* 根据入参 分页查询(当前)单位下的工程管道
*
* @param params - isIntoManagement 是否是否纳管 true/false
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgProjectContraptionServiceImplService.java
View file @
3049edbf
...
...
@@ -219,6 +219,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
deleteProjectAndEquInfoBySeq
(
Long
sequenceNbr
)
{
this
.
checkForDelete
(
Collections
.
singletonList
(
String
.
valueOf
(
sequenceNbr
)));
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
lambdaQuery
().
select
(
IdxBizJgUseInfo:
:
getRecord
).
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
sequenceNbr
).
list
();
// 删除idx设备表信息 + 删除对应es数据
List
<
String
>
records
=
useInfos
.
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
());
...
...
@@ -422,8 +423,9 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
List
<
Long
>
projectContraptionIdList
=
pageList
.
getRecords
().
stream
().
map
(
IdxBizJgProjectContraption:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Boolean
>
canEditMap
=
this
.
checkContraptionIsCanEdit
(
projectContraptionIdList
);
pageList
.
getRecords
().
forEach
(
record
->
record
.
setCanEdit
(
canEditMap
.
get
(
record
.
getSequenceNbr
()+
""
)));
Map
<
String
,
Boolean
>
canDeleteMap
=
this
.
checkContraptionIsCanDelete
(
projectContraptionIdList
,
isIntoManagement
);
pageList
.
getRecords
().
forEach
(
record
->
record
.
setCanDelete
(
canDeleteMap
.
get
(
record
.
getSequenceNbr
()+
""
)));
// 按钮放开, 删除提交时进行校验
// Map<String, Boolean> canDeleteMap = this.checkContraptionIsCanDelete(projectContraptionIdList, isIntoManagement);
// pageList.getRecords().forEach(record -> record.setCanDelete(canDeleteMap.get(record.getSequenceNbr()+"")));
//判断是否有检验结果录入
judgeCheckResult
(
pageList
.
getRecords
());
}
...
...
@@ -927,4 +929,57 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
page
.
setTotal
(
totalMap
.
get
(
"count"
));
return
page
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
deleteProjectAndEquInfoBatch
(
List
<
String
>
ids
)
{
// 检验
this
.
checkForDelete
(
ids
);
List
<
IdxBizJgUseInfo
>
useInfos
=
useInfoService
.
lambdaQuery
().
select
(
IdxBizJgUseInfo:
:
getRecord
).
in
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
ids
).
list
();
// 删除idx设备表信息 + 删除对应es数据
List
<
String
>
records
=
useInfos
.
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
());
if
(!
records
.
isEmpty
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"recordList"
,
records
);
map
.
put
(
"equList"
,
PipelineEnum
.
PRESSURE_PIPELINE
.
getCode
());
registerInfoService
.
batchDeleteByRecord
(
map
);
}
// 删除装置表信息
this
.
removeByIds
(
ids
);
eventPublisher
.
publish
(
new
DataRefreshEvent
(
this
,
useInfos
.
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
()),
DataRefreshEvent
.
DataType
.
equipment
.
name
(),
DataRefreshEvent
.
Operation
.
DELETE
));
return
Boolean
.
TRUE
;
}
/**
* 删除校验,被引用时不可删除
*
* @param pIds 装置ids
*/
private
void
checkForDelete
(
List
<
String
>
pIds
)
{
List
<
CountDto
>
useCounts
=
this
.
getBaseMapper
().
countContraptionInUseTimesForDeleteBatch
(
pIds
);
Map
<
String
,
Long
>
projectContraptionIdUseNumMap
=
useCounts
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
));
long
sum
=
projectContraptionIdUseNumMap
.
values
().
stream
().
reduce
(
0L
,
Long:
:
sum
);
if
(
sum
>
0
){
String
msg
=
getTipMsgString
(
projectContraptionIdUseNumMap
,
pIds
);
throw
new
BadRequest
(
msg
);
}
}
private
String
getTipMsgString
(
Map
<
String
,
Long
>
projectContraptionIdUseNumMap
,
List
<
String
>
pIds
)
{
List
<
Integer
>
indexes
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
pIds
.
size
();
i
++)
{
String
projectContraptionId
=
pIds
.
get
(
i
);
if
(
projectContraptionIdUseNumMap
.
getOrDefault
(
projectContraptionId
,
0L
)
>
0
)
{
indexes
.
add
(
i
+
1
);
}
}
if
(
pIds
.
size
()
>
1
)
{
return
String
.
format
(
"选择的第 %s 行装置已经在业务办理中,不能删除,请取消勾选!"
,
indexes
.
stream
()
.
map
(
String:
:
valueOf
)
.
collect
(
Collectors
.
joining
(
","
)));
}
else
{
return
"装置已经在业务办理中,不能删除!"
;
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
View file @
3049edbf
...
...
@@ -1250,14 +1250,30 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @param records
*/
private
void
checkForDelete
(
List
<
String
>
records
)
{
for
(
String
record
:
records
)
{
Boolean
isUsed
=
commonService
.
checkEquipIsUsed
(
record
);
if
(
isUsed
)
{
String
msg
=
getTipMsgString
(
record
);
throw
new
BadRequest
(
msg
);
}
List
<
CountDto
>
useCounts
=
commonMapper
.
countEquipInUseTimesWithOutZFBatch
(
records
);
Map
<
String
,
Long
>
recordUseNumMap
=
useCounts
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
)
);
long
sum
=
recordUseNumMap
.
values
().
stream
().
reduce
(
0L
,
Long:
:
sum
);
if
(
sum
>
0
){
String
msg
=
getTipMsgString
(
recordUseNumMap
,
records
);
throw
new
BadRequest
(
msg
);
}
}
private
String
getTipMsgString
(
Map
<
String
,
Long
>
recordUseNumMap
,
List
<
String
>
records
)
{
List
<
Integer
>
idxs
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
records
.
size
();
i
++)
{
String
record
=
records
.
get
(
i
);
if
(
recordUseNumMap
.
getOrDefault
(
record
,
0L
)
>
0
){
idxs
.
add
(
i
+
1
);
}
}
if
(
records
.
size
()
>
1
)
{
return
String
.
format
(
"选择的第 %s 行设备已经在业务办理中,不能删除,请取消勾选!"
,
idxs
.
stream
()
.
map
(
String:
:
valueOf
)
.
collect
(
Collectors
.
joining
(
","
)));
}
else
{
return
"设备已经在业务办理中,不能删除!"
;
}
}
private
Boolean
checkEquipIsCanDelete
(
String
record
)
{
...
...
@@ -1265,11 +1281,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
!
commonService
.
checkEquipIsUsed
(
record
);
}
private
String
getTipMsgString
(
String
record
)
{
IdxBizJgRegisterInfo
registerInfo
=
this
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
record
));
return
String
.
format
(
"存在业务办理中的设备,设备代码:%s"
,
registerInfo
.
getEquCode
());
}
/**
* 查询设备注册信息详情
*
...
...
@@ -3104,8 +3115,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
String
fullAddress
=
equAddressMap
.
get
(
item
.
getString
(
SEQUENCE_NBR
));
item
.
put
(
"ADDRESS"
,
!
ValidationUtil
.
isEmpty
(
fullAddress
)
?
fullAddress
:
""
);
item
.
put
(
"CAN_EDIT"
,
this
.
checkEquipIsCanEdit
(
item
.
getString
(
SEQUENCE_NBR
)));
item
.
put
(
"CAN_DELETE"
,
this
.
checkEquipIsCanDelete
(
item
.
getString
(
SEQUENCE_NBR
)));
item
.
put
(
"CAN_EDIT"
,
this
.
checkEquipIsCanEdit
(
item
.
getString
(
SEQUENCE_NBR
)));
// TODO 未纳管设备删除使用此字段,调整为前端始终显示删除按钮
// item.put("CAN_DELETE", this.checkEquipIsCanDelete(item.getString(SEQUENCE_NBR)));
// 单位类型区分是监管还是企业
item
.
put
(
"companyType"
,
companyLevel
);
// 区分新增设备、历史有证设备、历史无证设备,与使用登记一致:0-新设备、1-历史有证设备、2-历史无证设备
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/IdxBizJgProjectContraptionMapper.java
View file @
3049edbf
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.ContraptionQueryParams
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption
;
...
...
@@ -115,4 +116,13 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
void
updateDataQualityScoreBatch
(
@Param
(
"projectContraptions"
)
List
<
ProjectWaitRefreshDataQualityScore
>
projectContraptions
);
List
<
IdxBizJgTechParamsPipeline
>
selectPipelineListByProjectContraptionId
(
@Param
(
"projectContraptionId"
)
String
projectContraptionId
);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外)
*
* @param projectContraptionIdList 装置唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
List
<
CountDto
>
countContraptionInUseTimesForDeleteBatch
(
@Param
(
"projectContraptionIdList"
)
List
<
String
>
projectContraptionIdList
);
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/IdxBizJgProjectContraptionMapper.xml
View file @
3049edbf
...
...
@@ -146,6 +146,42 @@
GROUP BY
project_contraption_id;
</select>
<select
id=
"countContraptionInUseTimesForDeleteBatch"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
SELECT
project_contraption_id as keyStr,
SUM(inUseNumber) longValue
FROM (
SELECT
a.project_contraption_id,
COUNT(1) AS inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id = ANY(ARRAY[
<foreach
collection=
"projectContraptionIdList"
item=
"projectContraptionId"
separator=
","
>
#{projectContraptionId}
</foreach>
])
AND a.is_delete = 0
AND ( a.status
<![CDATA[ <> ]]>
'已作废')
group by a.project_contraption_id
UNION all
SELECT
a.project_contraption_id,
COUNT(1) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id = ANY(ARRAY[
<foreach
collection=
"projectContraptionIdList"
item=
"projectContraptionId"
separator=
","
>
#{projectContraptionId}
</foreach>
])
AND (a.notice_status
<![CDATA[ <> ]]>
'6617')
and a.is_delete = 0
group by a.project_contraption_id
)
GROUP BY
project_contraption_id
</select>
<select
id=
"selectErrorManagementProject"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption"
>
select
...
...
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