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
caab6266
Commit
caab6266
authored
Jul 23, 2024
by
王果
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
27994 注销报废限制设备不能多次出现在执行的流程中
parent
41e16c4c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
159 additions
and
0 deletions
+159
-0
JgScrapCancelMapper.java
...n/amos/boot/module/jg/api/mapper/JgScrapCancelMapper.java
+3
-0
JgScrapCancelMapper.xml
...-jg-api/src/main/resources/mapper/JgScrapCancelMapper.xml
+9
-0
JgScrapCancelEquipUsedCheckImpl.java
.../jg/biz/service/impl/JgScrapCancelEquipUsedCheckImpl.java
+54
-0
JgScrapCancelServiceImpl.java
.../module/jg/biz/service/impl/JgScrapCancelServiceImpl.java
+93
-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/JgScrapCancelMapper.java
View file @
caab6266
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancel
;
...
...
@@ -48,4 +49,6 @@ public interface JgScrapCancelMapper extends BaseMapper<JgScrapCancel> {
List
<
EquipBizCountDto
>
queryScrappedDeviceStaticListData
(
DPFilterParamDto
dpFilterParamDto
);
Integer
getScrappedDeviceCount
(
@Param
(
"dpFilterParamDto"
)
DPFilterParamDto
dpFilterParamDto
);
List
<
CompanyEquipCountDto
>
queryForFlowingEquipList
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgScrapCancelMapper.xml
View file @
caab6266
...
...
@@ -281,4 +281,13 @@
c.equ_category
</select>
<select
id=
"queryForFlowingEquipList"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"
>
select a.use_unit_code as companyCode,
group_concat(b.equ_id ) as records
from tzs_jg_scrap_cancel a,
tzs_jg_scrap_cancel_eq b
where a.sequence_nbr = b.equip_transfer_id
and a.audit_status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_code
</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/service/impl/JgScrapCancelEquipUsedCheckImpl.java
0 → 100644
View file @
caab6266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgScrapCancelMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
JgScrapCancelEquipUsedCheckImpl
extends
BaseEquipUsedCheckService
{
private
RedissonClient
redissonClient
;
private
String
bizType
=
"jgScrapCancelAdd"
;
private
JgScrapCancelMapper
mapper
;
public
JgScrapCancelEquipUsedCheckImpl
(
RedissonClient
redissonClient
,
JgScrapCancelMapper
mapper
)
{
this
.
redissonClient
=
redissonClient
;
this
.
mapper
=
mapper
;
}
@Override
public
RedissonClient
getRedisClient
()
{
return
redissonClient
;
}
@Override
public
String
getApplyBizType
()
{
return
bizType
;
}
@Override
public
void
init
()
{
// 初始化已经完成或者在流程中安装告知的设备数据
List
<
CompanyEquipCountDto
>
companyEquipCountDtos
=
mapper
.
queryForFlowingEquipList
();
companyEquipCountDtos
.
forEach
(
c
->
{
RBucket
<
Set
<
String
>>
rBucket
=
redissonClient
.
getBucket
(
getFlowingEquipRedisKey
(
c
.
getCompanyCode
(),
bizType
));
rBucket
.
set
(
Arrays
.
stream
(
c
.
getRecords
().
split
(
","
)).
collect
(
Collectors
.
toSet
()));
});
}
}
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/JgScrapCancelServiceImpl.java
View file @
caab6266
...
...
@@ -23,6 +23,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgScrapCancelMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgScrapCancelService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService
;
...
...
@@ -71,6 +74,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
PAGE_KEY
=
"jgScrapCancelAdd"
;
private
static
final
String
template
=
"%s发起%s%s业务申请,【申请单号:%s】"
;
private
final
List
<
String
>
NOT_FLOWING_STATE
=
Arrays
.
asList
(
"使用单位待提交"
,
"一级受理已驳回"
,
"使用单位已撤回"
,
"已作废"
,
"已完成"
);
@Autowired
WorkFlowFeignService
workFlowFeginService
;
@Autowired
...
...
@@ -178,6 +183,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
JgScrapCancelDto
save
(
String
submitType
,
Map
<
String
,
Object
>
mapParams
)
{
try
{
ReginParams
reginParams
=
this
.
getSelectedOrgInfo
();
Map
<
String
,
Object
>
noticeParams
=
(
Map
)
mapParams
.
get
(
PAGE_KEY
);
String
[]
receiveOrg
=
String
.
valueOf
(
noticeParams
.
get
(
"receiveOrgCreditCode"
)).
split
(
"_"
);
...
...
@@ -209,6 +215,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 判断当前是否为提交
List
<
WorkflowResultDto
>
workflowResultDtos
=
null
;
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
List
<
JgScrapCancelEq
>
JgScrapCancelEqList
=
getCancelEqs
(
noticeParams
);
this
.
repeatUsedEquipCheck
(
JgScrapCancelEqList
,
reginParams
.
getCompany
().
getCompanyCode
());
// 发起流程
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
...
...
@@ -266,6 +274,73 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
BeanUtil
.
copyProperties
(
jgScrapCancel
,
dto
);
dto
.
setEquListName
(
equListName
);
return
dto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
}
private
List
<
JgScrapCancelEq
>
getCancelEqs
(
Map
<
String
,
Object
>
noticeParams
)
{
List
<
JgScrapCancelEq
>
JgScrapCancelEqList
=
new
ArrayList
<>();
// 判断是否是报废气瓶业务处理
if
(
CancelTypeEnum
.
SCRAPPED
.
getCode
().
equals
(
noticeParams
.
get
(
"cancelType"
))
&&
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
noticeParams
.
get
(
"EQU_CATEGORY_CODE"
)))
{
List
<
Map
<
String
,
Object
>>
list
=
(
List
<
Map
<
String
,
Object
>>)
noticeParams
.
get
(
"equipments"
);
for
(
Map
<
String
,
Object
>
equip
:
list
)
{
JgScrapCancelEq
jgScrapCancelEq
=
new
JgScrapCancelEq
();
jgScrapCancelEq
.
setEquId
(
equip
.
get
(
"SEQUENCE_NBR"
).
toString
());
JgScrapCancelEqList
.
add
(
jgScrapCancelEq
);
}
}
else
{
List
<
Map
<
String
,
Object
>>
certificates
;
// 证列表
if
(
CylinderTypeEnum
.
SPECIAL_CYLINDER
.
getCode
().
equals
(
noticeParams
.
get
(
"EQU_CATEGORY_CODE"
)))
{
certificates
=
(
List
<
Map
<
String
,
Object
>>)
noticeParams
.
get
(
"cylCertificates"
);
}
else
{
certificates
=
(
List
<
Map
<
String
,
Object
>>)
noticeParams
.
get
(
"certificates"
);
}
// 使用登记证表idList
List
<
String
>
registrationIdList
=
certificates
.
stream
().
map
(
item
->
item
.
get
(
"sequenceNbr"
).
toString
()).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
equipmentList
=
jgUseRegistrationManageService
.
queryEquByCertificateSeqList
(
registrationIdList
.
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
()));
for
(
JSONObject
equip
:
equipmentList
)
{
JgScrapCancelEq
jgScrapCancelEq
=
new
JgScrapCancelEq
();
jgScrapCancelEq
.
setEquId
(
equip
.
getString
(
"SEQUENCE_NBR"
));
JgScrapCancelEqList
.
add
(
jgScrapCancelEq
);
}
}
return
JgScrapCancelEqList
;
}
private
void
repeatUsedEquipCheck
(
List
<
JgScrapCancelEq
>
eqList
,
String
companyCode
)
{
eqList
.
forEach
(
cancelEq
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PAGE_KEY
)
.
registrationRepeatUsedCheck
(
cancelEq
.
getEquId
(),
companyCode
));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private
void
delRepeatUseEquipData
(
JgScrapCancel
notice
)
{
if
(
NOT_FLOWING_STATE
.
contains
(
notice
.
getAuditStatus
()))
{
LambdaQueryWrapper
<
JgScrapCancelEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgScrapCancelEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
List
<
JgScrapCancelEq
>
noticeEqList
=
jgScrapCancelEqService
.
list
(
queryWrapper
);
noticeEqList
.
forEach
(
noticeEq
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PAGE_KEY
)
.
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
noticeEq
.
getEquId
()),
notice
.
getUseUnitCode
())
);
}
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PAGE_KEY
)
.
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
()));
}
/**
...
...
@@ -435,6 +510,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
JgScrapCancelDto
updateInfo
(
String
submitType
,
JgScrapCancelDto
jgScrapCancelDto
,
String
op
,
JSONObject
pageData
)
{
try
{
if
(
Objects
.
isNull
(
jgScrapCancelDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
...
...
@@ -443,6 +520,9 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
List
<
String
>
roleListNext
=
new
ArrayList
<>();
List
<
String
>
roleListAll
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
List
<
JgScrapCancelEq
>
JgScrapCancelEqList
=
getCancelEqs
(
pageData
);
this
.
repeatUsedEquipCheck
(
JgScrapCancelEqList
,
reginParams
.
getCompany
().
getCompanyCode
());
// 更新并提交
// 发起流程
if
(!
StringUtils
.
hasText
(
jgScrapCancelDto
.
getInstanceId
()))
{
...
...
@@ -519,6 +599,17 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
commonService
.
saveOrUpdateHistory
(
getRegistrationClass
(
jgScrapCancelDto
.
getCancelType
()),
pageData
,
""
,
jgScrapCancelDto
.
getSequenceNbr
().
toString
());
return
jgScrapCancelDto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
}
private
void
insertJgScrapCancelEqAfterDelete
(
JgScrapCancel
jgScrapCancel
,
JSONObject
pageData
)
{
...
...
@@ -723,6 +814,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgScrapCancel
));
this
.
delRepeatUseEquipData
(
jgScrapCancel
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
@@ -780,6 +872,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgScrapCancel
));
this
.
delRepeatUseEquipData
(
jgScrapCancel
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
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