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
5eb3e947
Commit
5eb3e947
authored
Jul 19, 2024
by
王果
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
21052 移装告知检验设备是否在流程中
parent
69eb8a3f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
148 deletions
+283
-148
JgTransferNoticeMapper.java
...mos/boot/module/jg/api/mapper/JgTransferNoticeMapper.java
+3
-0
JgTransferNoticeMapper.xml
...-api/src/main/resources/mapper/JgTransferNoticeMapper.xml
+12
-0
JgTransferNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
+207
-142
TransferNoticeEquipUsedCheckImpl.java
...jg/biz/service/impl/TransferNoticeEquipUsedCheckImpl.java
+55
-0
superviseBusinessCategory.json
...iz/src/main/resources/json/superviseBusinessCategory.json
+6
-6
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/JgTransferNoticeMapper.java
View file @
5eb3e947
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
...
@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
@MapKey
(
"sequenceNbr"
)
@MapKey
(
"sequenceNbr"
)
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
List
<
CompanyEquipCountDto
>
queryForFlowingEquipList
();
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgTransferNoticeMapper.xml
View file @
5eb3e947
...
@@ -217,4 +217,16 @@
...
@@ -217,4 +217,16 @@
tjtn.sequence_nbr = #{sequenceNbr}
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
LIMIT 1
</select>
</select>
<select
id=
"queryForFlowingEquipList"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"
>
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</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/impl/JgTransferNoticeServiceImpl.java
View file @
5eb3e947
...
@@ -24,6 +24,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
...
@@ -24,6 +24,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
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.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
...
@@ -141,7 +144,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -141,7 +144,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
transferNotice
.
put
(
"constructionContractList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
transferNotice
.
put
(
"constructionContractList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
else
if
(
"otherAccessories"
.
equalsIgnoreCase
(
s
))
{
}
else
if
(
"otherAccessories"
.
equalsIgnoreCase
(
s
))
{
transferNotice
.
put
(
"otherAccessoriesList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
transferNotice
.
put
(
"otherAccessoriesList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
else
{
}
else
{
transferNotice
.
put
(
s
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
transferNotice
.
put
(
s
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
}
}
}
...
@@ -172,6 +175,39 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -172,6 +175,39 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
private
void
checkRepeatUsed
(
String
submitType
,
JgTransferNotice
notice
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 流程中校验
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgTransferNoticeEq
noticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
noticeEq
.
getEquId
(),
notice
.
getInstallUnitCreditCode
());
}
}
private
void
repeatUsedEquipCheck
(
List
<
Map
<
String
,
Object
>>
equipList
,
String
companyCode
)
{
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private
void
delRepeatUseEquipData
(
JgTransferNotice
notice
)
{
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgTransferNoticeEq
noticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
noticeEq
.
getEquId
()),
notice
.
getInstallUnitCreditCode
());
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
}
private
Map
<
String
,
Object
>
getEquipInfoNew
(
String
companyLevel
,
Map
<
String
,
Object
>
transferNotice
,
List
<
Map
<
String
,
Object
>>
equipmentInfos
)
{
private
Map
<
String
,
Object
>
getEquipInfoNew
(
String
companyLevel
,
Map
<
String
,
Object
>
transferNotice
,
List
<
Map
<
String
,
Object
>>
equipmentInfos
)
{
Map
<
String
,
Object
>
detail
=
equipmentInfos
.
get
(
0
);
Map
<
String
,
Object
>
detail
=
equipmentInfos
.
get
(
0
);
Map
<
String
,
Object
>
equInfo
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
detail
.
get
(
"equId"
).
toString
());
Map
<
String
,
Object
>
equInfo
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
detail
.
get
(
"equId"
).
toString
());
...
@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
// 删除待办 及 中止流程
// 删除待办 及 中止流程
JgTransferNotice
jgTransferNotice
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
JgTransferNotice
jgTransferNotice
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
// 删除业务单
// 删除业务单
this
.
getBaseMapper
().
deleteById
(
sequenceNbr
);
this
.
getBaseMapper
().
deleteById
(
sequenceNbr
);
// 删除对应eq
// 删除对应eq
...
@@ -251,126 +287,138 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -251,126 +287,138 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@Transactional
@Transactional
public
JgTransferNoticeDto
updateTransferNotice
(
String
submitType
,
JgTransferNoticeDto
noticeDto
,
String
op
)
{
public
JgTransferNoticeDto
updateTransferNotice
(
String
submitType
,
JgTransferNoticeDto
noticeDto
,
String
op
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
try
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
throw
new
IllegalArgumentException
(
"参数不能为空"
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
}
throw
new
IllegalArgumentException
(
"参数不能为空"
);
// 字段转换
}
this
.
convertField
(
noticeDto
);
// 字段转换
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
this
.
convertField
(
noticeDto
);
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
checkRepeatUsed
(
submitType
,
notice
);
//校验设备是否在流程中
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
// 发起流程
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
// 如果没有实例ID,说明是启动并执行一步
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
// 如果没有实例ID,说明是启动并执行一步
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
//下一节点执行人单位(下节点接收机构code)
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
//下一节点执行人单位(下节点接收机构code)
list
.
add
(
dto
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
actWorkflowBatchDTO
.
setProcess
(
list
);
list
.
add
(
dto
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
actWorkflowBatchDTO
.
setProcess
(
list
);
// 提取节点等信息
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
// 提取节点等信息
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
}
else
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
}
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
}
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
// 如果为保存并提交,则创建代办
jgTransferNoticeMapper
.
updateById
(
notice
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRUE
);
}
else
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setVariable
(
commMap
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
processTaskDTO
=
iCmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
// 如果为保存并提交,则创建代办
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALS
E
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRU
E
);
}
else
{
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 创建新的代办
// 只调用执行API,返回下个节点信息,用于填充业务字段
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
//组装信息
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
TaskResultDTO
dto
=
new
TaskResultDTO
();
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
dto
.
setResultCode
(
"approvalStatus"
);
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
dto
.
setTaskId
(
notice
.
getNextTaskId
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
commMap
.
put
(
"approvalStatus"
,
"提交"
);
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
}
else
{
taskModelDto
.
setModel
(
taskMessageDto
);
commMap
.
put
(
"approvalStatus"
,
op
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
dto
.
setVariable
(
commMap
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
processTaskDTO
=
iCmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALSE
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgTransferNoticeMapper
.
updateById
(
bean
);
}
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
return
noticeDto
;
}
else
{
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
log
.
error
(
e
.
getMessage
(),
e
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
this
.
rollBackForDelRedisData
();
jgTransferNoticeMapper
.
updateById
(
bean
);
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
}
return
noticeDto
;
}
}
/**
/**
* 分页查询
* 分页查询
*/
*/
@Override
@Override
public
Page
<
Map
<
String
,
Object
>>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
String
sort
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
public
Page
<
Map
<
String
,
Object
>>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
String
sort
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
String
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
String
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
model
.
setTransferToUserIds
(
reginParams
.
getUserModel
().
getUserId
());
model
.
setTransferToUserIds
(
reginParams
.
getUserModel
().
getUserId
());
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgTransferNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
);
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgTransferNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
);
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
...
@@ -388,41 +436,57 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -388,41 +436,57 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgTransferNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgTransferNoticeDtoMap
,
ReginParams
reginParams
)
{
public
List
<
JgTransferNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgTransferNoticeDtoMap
,
ReginParams
reginParams
)
{
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgTransferNoticeDto
.
class
);
try
{
// 字段转换
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgTransferNoticeDto
.
class
);
convertField
(
model
);
// 字段转换
// 获取告知设备列表
convertField
(
model
);
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
// 获取告知设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
return
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
}
return
new
ArrayList
<>();
// 获取告知单号
}
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
return
new
ArrayList
<>();
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
}
}
// 启动工作流并返回信息
// 获取告知单号
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
return
new
ArrayList
<>();
//业务数据组装等
}
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
// 启动工作流并返回信息
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
// 如果为保存并提交,则创建代办
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
buildTask
(
list
,
workflowResultList
,
Boolean
.
TRUE
);
//业务数据组装等
}
else
{
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
// 暂存任务
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
buildTaskDraft
(
list
);
// 如果为保存并提交,则创建代办
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
,
workflowResultList
,
Boolean
.
TRUE
);
}
else
{
// 暂存任务
buildTaskDraft
(
list
);
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
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
();
}
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
}
private
void
updateRedisBatch
(
List
<
JgTransferNotice
>
jgTransferNotices
)
{
private
void
updateRedisBatch
(
List
<
JgTransferNotice
>
jgTransferNotices
)
{
...
@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jsonObject
.
put
(
"nextTaskId"
,
jgTransferNotice
.
getNextTaskId
());
jsonObject
.
put
(
"nextTaskId"
,
jgTransferNotice
.
getNextTaskId
());
commonService
.
rollbackTask
(
jgTransferNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
rollbackTask
(
jgTransferNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransferNotice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransferNotice
));
this
.
delRepeatUseEquipData
(
jgTransferNotice
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
...
...
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/TransferNoticeEquipUsedCheckImpl.java
0 → 100644
View file @
5eb3e947
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.JgMaintainNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper
;
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
TransferNoticeEquipUsedCheckImpl
extends
BaseEquipUsedCheckService
{
private
RedissonClient
redissonClient
;
private
String
bizType
=
"transferNotice"
;
private
JgTransferNoticeMapper
noticeMapper
;
public
TransferNoticeEquipUsedCheckImpl
(
RedissonClient
redissonClient
,
JgTransferNoticeMapper
noticeMapper
)
{
this
.
redissonClient
=
redissonClient
;
this
.
noticeMapper
=
noticeMapper
;
}
@Override
public
RedissonClient
getRedisClient
()
{
return
redissonClient
;
}
@Override
public
String
getApplyBizType
()
{
return
bizType
;
}
@Override
public
void
init
()
{
// 初始化已经完成或者在流程中安装告知的设备数据
List
<
CompanyEquipCountDto
>
companyEquipCountDtos
=
noticeMapper
.
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/resources/json/superviseBusinessCategory.json
View file @
5eb3e947
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"name"
:
"移装告知"
,
"name"
:
"移装告知"
,
"code"
:
"GZ_YZ"
,
"code"
:
"GZ_YZ"
,
"image"
:
"upload/tzs/common/image/移装告知.png"
,
"image"
:
"upload/tzs/common/image/移装告知.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
}
],
],
"DJGL"
:
[
"DJGL"
:
[
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
"name"
:
"移装变更登记"
,
"name"
:
"移装变更登记"
,
"code"
:
"DJ_YZ"
,
"code"
:
"DJ_YZ"
,
"image"
:
"upload/tzs/common/image/移装变更登记.png"
,
"image"
:
"upload/tzs/common/image/移装变更登记.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
},
{
{
"name"
:
"单位变更登记"
,
"name"
:
"单位变更登记"
,
...
@@ -88,16 +88,16 @@
...
@@ -88,16 +88,16 @@
"image"
:
"upload/tzs/common/image/注销报废.png"
"image"
:
"upload/tzs/common/image/注销报废.png"
},
},
{
{
"name"
:
"
设备
启用"
,
"name"
:
"启用"
,
"code"
:
"SB_QY"
,
"code"
:
"SB_QY"
,
"image"
:
"upload/tzs/common/image/设备启用.png"
,
"image"
:
"upload/tzs/common/image/设备启用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
},
{
{
"name"
:
"
设备
停用"
,
"name"
:
"停用"
,
"code"
:
"SB_TY"
,
"code"
:
"SB_TY"
,
"image"
:
"upload/tzs/common/image/设备停用.png"
,
"image"
:
"upload/tzs/common/image/设备停用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
}
],
],
"XZSB"
:
[
"XZSB"
:
[
...
...
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