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
aff6e4ef
Commit
aff6e4ef
authored
Mar 21, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.删除编辑增加约束无流程引用时,可编辑、可删除
parent
6dda69a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
288 additions
and
13 deletions
+288
-13
CommonMapper.java
.../yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
+16
-0
CommonMapper.xml
...-module-jg-api/src/main/resources/mapper/CommonMapper.xml
+214
-0
ICommonService.java
...ejoin/amos/boot/module/jg/biz/service/ICommonService.java
+15
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+11
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+32
-13
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 @
aff6e4ef
...
@@ -34,5 +34,21 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
...
@@ -34,5 +34,21 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
void
updateBusinessData
(
String
tableName
,
String
assignee
,
String
transferToUserIds
,
String
instanceId
,
String
nextTaskId
);
void
updateBusinessData
(
String
tableName
,
String
assignee
,
String
transferToUserIds
,
String
instanceId
,
String
nextTaskId
);
Map
<
String
,
Object
>
getUserPhone
(
String
name
,
String
companyCode
);
Map
<
String
,
Object
>
getUserPhone
(
String
name
,
String
companyCode
);
/**
* 统计指定设备流程中的引用次数(12个流程中,非待提交、非已撤回、非已驳回)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可编辑
*/
Integer
countEquipInUseTimesForEdit
(
String
record
);
/**
* 统计设备被引用的次数(只有存在就算引用)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer
countEquipInUseTimesForDel
(
String
record
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/CommonMapper.xml
View file @
aff6e4ef
...
@@ -98,5 +98,219 @@
...
@@ -98,5 +98,219 @@
where
where
instance_id = #{instanceId}
instance_id = #{instanceId}
</select>
</select>
<select
id=
"countEquipInUseTimesForEdit"
resultType=
"java.lang.Integer"
>
select
sum(inUseNumber)
from (
select
count(1) as inUseNumber
from
tzs_jg_use_registration a,
tzs_jg_use_registration_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'使用单位待提交' and a.status
<![CDATA[ <> ]]>
'一级受理已驳回' and a.status
<![CDATA[ <> ]]>
'使用单位已撤回')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_reform a,
tzs_jg_change_registration_reform_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'使用单位待提交' and a.audit_status
<![CDATA[ <> ]]>
'一级受理已驳回' and a.audit_status
<![CDATA[ <> ]]>
'使用单位已撤回')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_transfer a,
tzs_jg_change_registration_transfer_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'使用单位待提交' and a.audit_status
<![CDATA[ <> ]]>
'一级受理已驳回' and a.audit_status
<![CDATA[ <> ]]>
'使用单位已撤回')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_unit a,
tzs_jg_change_registration_unit_eq b
where
a.sequence_nbr = b.unit_change_registration_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'使用单位待提交' and a.status
<![CDATA[ <> ]]>
'一级受理已驳回' and a.status
<![CDATA[ <> ]]>
'使用单位已撤回')
UNION
select
count(1) as inUseNumber
from
tzs_jg_enable_disable a,
tzs_jg_enable_disable_eq b
where
a.sequence_nbr = b.enable_disable_apply_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'已驳回' and a.audit_status
<![CDATA[ <> ]]>
'已撤回' and a.audit_status
<![CDATA[ <> ]]>
'待提交')
UNION
select
count(1) as inUseNumber
from
tzs_jg_equip_transfer a,
tzs_jg_equip_transfer_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.apply_status
<![CDATA[ <> ]]>
'6614' and a.apply_status
<![CDATA[ <> ]]>
'6615' and a.apply_status
<![CDATA[ <> ]]>
'6610')
UNION
select
count(1) as inUseNumber
from
tzs_jg_installation_notice a,
tzs_jg_installation_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6614' and a.notice_status
<![CDATA[ <> ]]>
'6615' and a.notice_status
<![CDATA[ <> ]]>
'6610')
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintain_notice a,
tzs_jg_maintain_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6614' and a.notice_status
<![CDATA[ <> ]]>
'6615' and a.notice_status
<![CDATA[ <> ]]>
'6610')
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintenance_contract a,
tzs_jg_maintenance_contract_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'维保单位已驳回' and a.status
<![CDATA[ <> ]]>
'使用单位已撤回' and a.status
<![CDATA[ <> ]]>
'使用单位待提交')
UNION
select
count(1) as inUseNumber
from
tzs_jg_reform_notice a,
tzs_jg_reform_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6614' and a.notice_status
<![CDATA[ <> ]]>
'6615' and a.notice_status
<![CDATA[ <> ]]>
'6610')
UNION
select
count(1) as inUseNumber
from
tzs_jg_scrap_cancel a,
tzs_jg_scrap_cancel_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'使用单位已撤回' and a.audit_status
<![CDATA[ <> ]]>
'一级受理已驳回' and a.audit_status
<![CDATA[ <> ]]>
'使用单位待提交')
UNION
select
count(1) as inUseNumber
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6614' and a.notice_status
<![CDATA[ <> ]]>
'6615' and a.notice_status
<![CDATA[ <> ]]>
'6610')
)
</select>
<select
id=
"countEquipInUseTimesForDel"
resultType=
"java.lang.Integer"
>
select
sum(inUseNumber)
from (
select
count(1) as inUseNumber
from
tzs_jg_use_registration_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_reform_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_transfer_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_unit_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_enable_disable_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_equip_transfer_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_installation_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintain_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintenance_contract_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_reform_notice_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_scrap_cancel_eq b
where
b.equ_id = #{record}
UNION
select
count(1) as inUseNumber
from
tzs_jg_transfer_notice_eq b
where
b.equ_id = #{record}
)
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/ICommonService.java
View file @
aff6e4ef
...
@@ -130,4 +130,19 @@ public interface ICommonService {
...
@@ -130,4 +130,19 @@ public interface ICommonService {
* @return Object
* @return Object
*/
*/
Object
queryHistoryDataObj
(
Long
currentDocumentId
);
Object
queryHistoryDataObj
(
Long
currentDocumentId
);
/**
* 统计指定设备流程中的引用次数(12个流程中,非待提交、非已撤回、非已驳回)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可编辑
*/
Integer
countEquipInUseTimesForEdit
(
String
record
);
/**
* 统计设备被引用的次数(只有存在就算引用)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer
countEquipInUseTimesForDel
(
String
record
);
}
}
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/CommonServiceImpl.java
View file @
aff6e4ef
...
@@ -1610,4 +1610,14 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -1610,4 +1610,14 @@ public class CommonServiceImpl implements ICommonService {
}
}
}
}
@Override
public
Integer
countEquipInUseTimesForEdit
(
String
record
){
return
commonMapper
.
countEquipInUseTimesForEdit
(
record
);
}
@Override
public
Integer
countEquipInUseTimesForDel
(
String
record
){
return
commonMapper
.
countEquipInUseTimesForDel
(
record
);
}
}
}
\ 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 @
aff6e4ef
...
@@ -52,6 +52,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
...
@@ -52,6 +52,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -182,6 +183,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -182,6 +183,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(
count
>
0
)
{
if
(
count
>
0
)
{
throw
new
LocalBadRequest
(
"设备代码已存在,请重新输入!"
);
throw
new
LocalBadRequest
(
"设备代码已存在,请重新输入!"
);
}
}
// 编辑校验
this
.
checkForEquipEdit
(
equipmentInfoForm
.
get
(
"RECORD"
));
//操作类型
//操作类型
try
{
try
{
//保存数据
//保存数据
...
@@ -209,12 +212,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -209,12 +212,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
ResponseHelper
.
buildResponse
(
record
);
return
ResponseHelper
.
buildResponse
(
record
);
}
}
private
void
checkForEquipEdit
(
Object
record
)
{
// 标识编辑
if
(
record
!=
null
){
Integer
inUseTime
=
commonService
.
countEquipInUseTimesForEdit
(
record
.
toString
());
if
(
inUseTime
>
0
){
throw
new
BadRequest
(
"此设备在被其他业务引用,不可编辑!"
);
}
}
}
/**
/**
* 删除设备注册信息(批量删除)
* 删除设备注册信息(批量删除)
*
*
* @param map
* @param map
* @return
* @return
*/
*/
@Override
public
boolean
batchDeleteByRecord
(
Map
<
String
,
Object
>
map
)
{
public
boolean
batchDeleteByRecord
(
Map
<
String
,
Object
>
map
)
{
Object
recordList
=
map
.
get
(
"recordList"
);
Object
recordList
=
map
.
get
(
"recordList"
);
List
<
String
>
records
=
new
ArrayList
<>();
List
<
String
>
records
=
new
ArrayList
<>();
...
@@ -233,6 +247,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -233,6 +247,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentCategoryDto
.
setSEQUENCE_NBR
(
recordList
.
toString
());
esEquipmentCategoryDto
.
setSEQUENCE_NBR
(
recordList
.
toString
());
list
.
add
(
esEquipmentCategoryDto
);
list
.
add
(
esEquipmentCategoryDto
);
}
}
// 删除校验,被引用时不可删除
this
.
checkForDelete
(
records
);
//删除涉及的19张表的数据
//删除涉及的19张表的数据
superviseInfoMapper
.
deleteDataAll
(
records
);
superviseInfoMapper
.
deleteDataAll
(
records
);
...
@@ -241,6 +257,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -241,6 +257,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
true
;
return
true
;
}
}
private
void
checkForDelete
(
List
<
String
>
records
)
{
for
(
String
record:
records
){
Integer
useTime
=
commonService
.
countEquipInUseTimesForDel
(
record
);
if
(
useTime
>
0
){
String
msg
=
getTipMsgString
(
record
);
throw
new
BadRequest
(
msg
);
}
}
}
private
String
getTipMsgString
(
String
record
)
{
IdxBizJgRegisterInfo
registerInfo
=
this
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
record
));
return
String
.
format
(
"存在被引用的设备,设备代码:%s"
,
registerInfo
.
getEquCode
());
}
/**
/**
* 查询设备注册信息详情
* 查询设备注册信息详情
*
*
...
@@ -1192,17 +1224,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -1192,17 +1224,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
equIds
=
list
.
stream
().
map
(
item
->
item
.
get
(
"SEQUENCE_NBR"
).
toString
()).
collect
(
Collectors
.
toList
());
equIds
=
list
.
stream
().
map
(
item
->
item
.
get
(
"SEQUENCE_NBR"
).
toString
()).
collect
(
Collectors
.
toList
());
}
}
if
(!
ValidationUtil
.
isEmpty
(
equIds
)){
if
(!
ValidationUtil
.
isEmpty
(
equIds
)){
//查询设备是否正在使用
//设备的使用标识是,安装告知和使用登记中有使用记录。
List
<
JgInstallationNoticeEq
>
installationNoticeEqList
=
jgInstallationNoticeEqServiceImpl
.
getListByEquIds
(
equIds
);
List
<
JgUseRegistrationEq
>
useRegistrationEqList
=
jgUseRegistrationEqServiceImpl
.
getListByEquIds
(
equIds
);
Map
<
String
,
Boolean
>
equIsUseMap
=
new
HashMap
<>();
if
(!
ValidationUtil
.
isEmpty
(
installationNoticeEqList
)
){
equIsUseMap
.
putAll
(
installationNoticeEqList
.
stream
().
collect
(
Collectors
.
toMap
(
JgInstallationNoticeEq:
:
getEquId
,
obj
->
true
,
(
oldValue
,
newValue
)
->
oldValue
)));
}
if
(!
ValidationUtil
.
isEmpty
(
useRegistrationEqList
)){
equIsUseMap
.
putAll
(
useRegistrationEqList
.
stream
().
collect
(
Collectors
.
toMap
(
JgUseRegistrationEq:
:
getEquId
,
obj
->
true
,
(
oldValue
,
newValue
)
->
oldValue
)));
}
// 查询设备地址
// 查询设备地址
List
<
IdxBizJgUseInfo
>
useInfoListByEquIds
=
idxBizJgUseInfoService
.
getUseInfoListByEquIds
(
equIds
);
List
<
IdxBizJgUseInfo
>
useInfoListByEquIds
=
idxBizJgUseInfoService
.
getUseInfoListByEquIds
(
equIds
);
Map
<
String
,
String
>
equAddressMap
=
new
HashMap
<>();
Map
<
String
,
String
>
equAddressMap
=
new
HashMap
<>();
...
@@ -1222,9 +1243,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -1222,9 +1243,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
// 更新设备使用情况和设备地址
// 更新设备使用情况和设备地址
for
(
JSONObject
item
:
list
){
for
(
JSONObject
item
:
list
){
Boolean
isUse
=
equIsUseMap
.
get
(
item
.
getString
(
"SEQUENCE_NBR"
));
String
fullAddress
=
equAddressMap
.
get
(
item
.
getString
(
"SEQUENCE_NBR"
));
String
fullAddress
=
equAddressMap
.
get
(
item
.
getString
(
"SEQUENCE_NBR"
));
item
.
put
(
"IS_USE"
,
!
ValidationUtil
.
isEmpty
(
isUse
)
?
isUse
?
isUse
:
false
:
false
);
item
.
put
(
"ADDRESS"
,
!
ValidationUtil
.
isEmpty
(
fullAddress
)
?
fullAddress
:
""
);
item
.
put
(
"ADDRESS"
,
!
ValidationUtil
.
isEmpty
(
fullAddress
)
?
fullAddress
:
""
);
}
}
}
}
...
...
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