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
e84ef003
Commit
e84ef003
authored
Jan 12, 2024
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安装告知模块 功能开发
parent
4e2c7589
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
311 additions
and
424 deletions
+311
-424
JgInstallationNoticeDto.java
.../amos/boot/module/jg/api/dto/JgInstallationNoticeDto.java
+9
-0
JgInstallationNotice.java
.../amos/boot/module/jg/api/entity/JgInstallationNotice.java
+15
-0
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+283
-421
JgTransferNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
+2
-1
urlInfo.json
...s-boot-module-jg-biz/src/main/resources/json/urlInfo.json
+2
-2
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/dto/JgInstallationNoticeDto.java
View file @
e84ef003
...
@@ -248,5 +248,14 @@ public class JgInstallationNoticeDto extends BaseDto {
...
@@ -248,5 +248,14 @@ public class JgInstallationNoticeDto extends BaseDto {
@JsonSerialize
(
using
=
BizCustomDateSerializer
.
class
)
@JsonSerialize
(
using
=
BizCustomDateSerializer
.
class
)
private
Date
handleDate
;
private
Date
handleDate
;
private
String
createUserCompanyName
;
//下一步任务ID
private
String
nextTaskId
;
/**
* 创建人
*/
private
String
createUserName
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgInstallationNotice.java
View file @
e84ef003
...
@@ -400,4 +400,19 @@ public class JgInstallationNotice extends BaseEntity {
...
@@ -400,4 +400,19 @@ public class JgInstallationNotice extends BaseEntity {
*/
*/
private
String
approvalStatus
;
private
String
approvalStatus
;
@TableField
(
value
=
"\"create_user_company_name\""
)
private
String
createUserCompanyName
;
//下一步任务ID
@TableField
(
value
=
"\"next_taskId\""
)
private
String
nextTaskId
;
/**
* 创建人
*/
@TableField
(
"\"create_user_name\""
)
private
String
createUserName
;
}
}
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/JgInstallationNoticeServiceImpl.java
View file @
e84ef003
...
@@ -13,12 +13,18 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...
@@ -13,12 +13,18 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
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.IIdxBizJgConstructionInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils
;
...
@@ -35,10 +41,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...
@@ -35,10 +41,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
fr.opensagres.xdocreport.core.io.IOUtils
;
import
fr.opensagres.xdocreport.core.io.IOUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -141,6 +144,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -141,6 +144,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
@Autowired
AmosRequestContext
amosRequestContext
;
AmosRequestContext
amosRequestContext
;
@Autowired
private
ICmWorkflowService
iCmWorkflowService
;
@Autowired
private
CommonServiceImpl
commonService
;
/**
/**
* 根据sequenceNbr查询
* 根据sequenceNbr查询
*
*
...
@@ -184,10 +194,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -184,10 +194,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
equipmentInfos
.
get
(
0
).
put
(
s
,
parseArray
(
equipmentInfos
.
get
(
0
).
get
(
s
).
toString
()));
equipmentInfos
.
get
(
0
).
put
(
s
,
parseArray
(
equipmentInfos
.
get
(
0
).
get
(
s
).
toString
()));
}
}
}
}
Map
<
String
,
Object
>
map
=
equipmentInfos
.
get
(
0
);
BeanUtil
.
copyProperties
(
installationInfo
,
map
,
"equList"
,
"supervisoryCode"
);
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
this
.
put
(
"installationInfo"
,
installationInfo
);
this
.
put
(
"installationInfo"
,
map
);
this
.
put
(
"equipmentInfo"
,
equipmentInfos
.
get
(
0
));
}};
}};
}
}
...
@@ -198,89 +208,104 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -198,89 +208,104 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
public
JgInstallationNoticeDto
updateInstallationNotice
(
String
submitType
,
JgInstallationNoticeDto
noticeDto
,
String
op
)
{
public
JgInstallationNoticeDto
updateInstallationNotice
(
String
submitType
,
JgInstallationNoticeDto
noticeDto
,
String
op
)
{
boolean
instancedId
=
ObjectUtils
.
isEmpty
(
noticeDto
.
getInstanceId
()
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
}
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
// 字段转换
this
.
convertField
(
noticeDto
);
this
.
convertField
(
noticeDto
);
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>(
);
JgInstallationNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
()
);
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
AjaxResult
ajaxResult
;
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 发起流程
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
"1"
);
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
try
{
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
list
.
add
(
dto
);
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
actWorkflowBatchDTO
.
setProcess
(
list
);
noticeDto
.
setInstanceId
(
instanceId
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 查询下节点任务
// 提取节点等信息
getNext
(
roleListFirst
,
instanceId
,
taskName
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
noticeDto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
}
catch
(
Exception
e
)
{
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
log
.
error
(
"提交失败:{}"
,
e
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
this
.
updateById
(
notice
);
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
));
}
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
);
JgInstallationNotice
notice
=
new
JgInstallationNotice
();
processTaskDTO
=
iCmWorkflowService
.
complete
(
notice
.
getNextTaskId
(),
dto
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
boolean
submit
=
submit
(
notice
,
op
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(
submit
)
{
// 查询下节点任务
getNext
(
roleListSecond
,
notice
.
getInstanceId
(),
taskName
);
notice
.
setStatus
(
taskName
[
0
]);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListSecond
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
()
);
}
else
{
}
else
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListSecond
));
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
(
));
}
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()
));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
jgInstallationNoticeMapper
.
updateById
(
notice
);
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
()
);
}
this
.
updateById
(
notice
);
if
(!
instancedId
)
{
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
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
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
updateTaskModel
(
map
,
null
);
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
));
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
notice
);
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
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
}
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
//获取待办任务执行人
List
<
AgencyUserModel
>
userList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
notice
.
getNextExecuteIds
(),
null
,
Boolean
.
FALSE
).
getResult
();
List
<
String
>
userIds
=
userList
.
stream
().
map
(
AgencyUserModel:
:
getUserId
).
collect
(
Collectors
.
toList
());
taskV2Model
.
setExecuteUserIds
(
CollectionUtils
.
isEmpty
(
userIds
)?
""
:
String
.
join
(
","
,
userIds
));
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
notice
));
taskV2Model
.
setRelationId
(
notice
.
getInstanceId
());
Map
<
String
,
Object
>
userOrgRoleMap
=
FeignUtil
.
remoteCall
(()
->
Privilege
.
userOrgRoleClient
.
getme
());
List
<
String
>
userOrgRoleList
=
(
List
<
String
>)
userOrgRoleMap
.
get
(
"roleId"
);
String
roleIds
=
String
.
join
(
","
,
userOrgRoleList
);
taskV2Model
.
setTaskType
(
"installNotice"
);
taskV2Model
.
setTaskTypeLabel
(
"安装告知"
);
String
url
=
getUrl
(
taskV2Model
.
getTaskType
(),
"look"
);
String
format
=
String
.
format
(
url
,
notice
.
getSequenceNbr
(),
notice
.
getNextExecuteIds
(),
notice
.
getNextExecuteIds
(),
notice
.
getNoticeStatus
(),
notice
.
getInstanceId
());
taskV2Model
.
setRoutePath
(
format
);
taskV2Model
.
setTaskTitle
(
notice
.
getStatus
());
taskV2Model
.
setTaskName
(
notice
.
getStatus
());
taskV2Model
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskV2Model
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskV2Model
.
setTaskCode
(
notice
.
getApplyNo
());
buildTaskModel
(
taskV2Model
);
}
else
{
}
else
{
JgInstallationNotice
bean
=
new
JgInstallationNotice
();
JgInstallationNotice
bean
=
new
JgInstallationNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgInstallationNoticeMapper
.
updateById
(
bean
);
this
.
updateById
(
bean
);
}
}
return
noticeDto
;
return
noticeDto
;
}
}
...
@@ -433,11 +458,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -433,11 +458,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveNotice
(
String
submitType
,
JSONObject
jgInstallationNoticeDtoMap
,
ReginParams
reginParams
)
{
public
void
saveNotice
(
String
submitType
,
JSONObject
jgInstallationNoticeDtoMap
,
ReginParams
reginParams
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
// JgInstallationNoticeDto model = BeanUtil.toBeanIgnoreError(jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID).toString(), JgInstallationNoticeDto.class);
JgInstallationNoticeDto
model
=
JSON
.
parseObject
(
jgInstallationNoticeDtoMap
.
get
(
TABLE_PAGE_ID
).
toString
(),
JgInstallationNoticeDto
.
class
);
JgInstallationNoticeDto
model
=
JSON
.
parseObject
(
jgInstallationNoticeDtoMap
.
get
(
TABLE_PAGE_ID
).
toString
(),
JgInstallationNoticeDto
.
class
);
// 字段转换
// 字段转换
convertField
(
model
);
convertField
(
model
);
...
@@ -447,7 +468,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -447,7 +468,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"设备列表为空"
);
throw
new
BadRequest
(
"设备列表为空"
);
}
}
// 获取告知单号
// 获取告知单号
ResponseModel
<
List
<
String
>>
listResponseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
AZGZ
.
getCode
(),
deviceList
.
size
());
ResponseModel
<
List
<
String
>>
listResponseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
AZGZ
.
getCode
(),
deviceList
.
size
());
if
(!
ObjectUtils
.
isEmpty
(
listResponseModel
)
&&
listResponseModel
.
getStatus
()
!=
HttpStatus
.
OK
.
value
())
{
if
(!
ObjectUtils
.
isEmpty
(
listResponseModel
)
&&
listResponseModel
.
getStatus
()
!=
HttpStatus
.
OK
.
value
())
{
...
@@ -460,9 +480,57 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -460,9 +480,57 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
throw
new
BadRequest
(
"告知单生成失败!"
);
throw
new
BadRequest
(
"告知单生成失败!"
);
}
}
// 启动工作流并返回信息
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
);
List
<
JgInstallationNotice
>
list
=
new
ArrayList
<>();
List
<
JgInstallationNotice
>
list
=
new
ArrayList
<>();
List
<
JgInstallationNoticeEq
>
equipList
=
new
ArrayList
<>();
List
<
JgInstallationNoticeEq
>
equipList
=
new
ArrayList
<>();
//业务数据组装等
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
applyNoList
,
list
,
equipList
,
workflowResultList
);
jgInstallationNoticeMapper
.
insertBatchSomeColumn
(
list
);
// 如果为保存并提交,则创建代办
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
,
workflowResultList
);
}
List
<
JgInstallationNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgInstallationNotice
>
collect
=
list
.
stream
().
filter
(
jgInstallationNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
jgInstallationNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgInstallationNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
private
void
buildTask
(
List
<
JgInstallationNotice
>
list
,
List
<
WorkflowResultDto
>
workflowResultList
)
{
List
<
TaskModelDto
>
taskModelDtoList
=
new
ArrayList
<>();
WorkflowResultDto
workflowResultDto
=
workflowResultList
.
get
(
0
);
list
.
forEach
(
item
->
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
taskModelDto
.
setFlowCreateDate
(
item
.
getCreateDate
());
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
// 工作流API返回
taskModelDto
.
setTaskCode
(
item
.
getApplyNo
());
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getCode
());
taskModelDto
.
setTaskTypeLabel
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getName
());
taskModelDto
.
setRelationId
(
item
.
getInstanceId
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
// 工作流API返回
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowStatus
(
commonService
.
getDictionaryCodeByName
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
()));
// 流程状态枚举
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
item
.
getNextTaskId
());
taskModelDto
.
setStartUserId
(
item
.
getCreateUserId
());
taskModelDto
.
setStartUser
(
item
.
getCreateUserName
());
taskModelDto
.
setStartUserCompanyName
(
item
.
getCreateUserCompanyName
());
// 任务发起人所在单位
taskModelDto
.
setStartDate
(
item
.
getCreateDate
());
taskModelDto
.
setModel
(
item
);
taskModelDto
.
setNextExecuteUser
(
item
.
getNextExecuteIds
());
taskModelDto
.
setTaskContent
(
String
.
format
(
"来自%s【%s】的业务办理,【申请单号:%s】"
,
item
.
getEquList
(),
item
.
getEquRegisterCode
(),
item
.
getApplyNo
()));
taskModelDtoList
.
add
(
taskModelDto
);
});
commonService
.
buildTaskModel
(
taskModelDtoList
);
}
private
void
businessData
(
String
submitType
,
ReginParams
reginParams
,
JgInstallationNoticeDto
model
,
List
<
Map
<
String
,
Object
>>
deviceList
,
List
<
String
>
applyNoList
,
List
<
JgInstallationNotice
>
list
,
List
<
JgInstallationNoticeEq
>
equipList
,
List
<
WorkflowResultDto
>
workflowResultList
)
{
deviceList
.
forEach
(
obj
->
{
deviceList
.
forEach
(
obj
->
{
JgInstallationNoticeEq
jgRelationEquip
=
new
JgInstallationNoticeEq
();
JgInstallationNoticeEq
jgRelationEquip
=
new
JgInstallationNoticeEq
();
JgInstallationNotice
dto
=
new
JgInstallationNotice
();
JgInstallationNotice
dto
=
new
JgInstallationNotice
();
...
@@ -472,116 +540,61 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -472,116 +540,61 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto
.
setApplyNo
(
applyNo
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setPromoter
(
RequestContext
.
getExeUserId
());
dto
.
setNextExecuteIds
(
workflowResultList
.
get
(
i
).
getNextExecutorRoleIds
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
dto
.
setInstanceStatus
(
workflowResultList
.
get
(
i
).
getNextExecutorRoleIds
()
+
","
+
workflowResultList
.
get
(
i
).
getExecutorRoleIds
());
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNextTaskId
(
workflowResultList
.
get
(
i
).
getNextTaskId
());
}
}
dto
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
dto
.
setEquList
((
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
))));
dto
.
setEquList
((
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
))));
dto
.
setEntrustingUnitName
(
dto
.
getUseUnitName
());
dto
.
setEntrustingUnitName
(
dto
.
getUseUnitName
());
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setEquRegisterCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_CODE"
)));
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
dto
.
getProvinceName
()).
append
(
dto
.
getCityName
()).
append
(
dto
.
getCountyName
()).
append
(
dto
.
getAddress
());
buffer
.
append
(
dto
.
getProvinceName
()).
append
(
dto
.
getCityName
()).
append
(
dto
.
getCountyName
()).
append
(
dto
.
getAddress
());
dto
.
setEquAddress
(
buffer
.
toString
());
dto
.
setEquAddress
(
buffer
.
toString
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
if
(!
CollectionUtils
.
isEmpty
(
workflowResultList
))
{
dto
.
setInstanceId
(
workflowResultList
.
get
(
i
).
getInstanceId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
list
.
add
(
dto
);
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
equipList
.
add
(
jgRelationEquip
);
});
});
}
jgInstallationNoticeMapper
.
insertBatchSomeColumn
(
list
);
/**
* 工作流启动并执行
List
<
JgInstallationNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
* @param submitType 是否提交
List
<
JgInstallationNotice
>
collect
=
list
.
stream
().
filter
(
jgInstallationNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
jgInstallationNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
* @param deviceList 设备信息
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
* @return 工作流返回相关数据
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
*/
}).
collect
(
Collectors
.
toList
());
private
List
<
WorkflowResultDto
>
workFlowInfo
(
String
submitType
,
List
<
Map
<
String
,
Object
>>
deviceList
)
{
jgInstallationNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
// 需要在事务提交之后,否则事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
workflowStartDTOS
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
deviceList
.
forEach
(
item
->
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
item
.
getSequenceNbr
()
+
""
);
dto
.
setBusinessKey
(
item
.
get
(
"SEQUENCE_NBR"
).
toString
()
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
workflowStartDTOS
.
add
(
dto
);
list
.
add
(
dto
);
}
});
});
try
{
actWorkflowBatchDTO
.
setProcess
(
list
);
actWorkflowBatchDTO
.
setProcess
(
workflowStartDTOS
);
List
<
ProcessTaskDTO
>
processTaskDTOS
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
Workflow
.
taskV2Client
.
startByVariableBatch
(
actWorkflowBatchDTO
);
// 组装工作流返回的数据
}
catch
(
Exception
e
)
{
return
commonService
.
buildWorkFlowInfo
(
processTaskDTOS
);
log
.
error
(
"提交失败:{}"
,
e
);
}
}
return
new
ArrayList
<>();
}
}
});
// platformTransactionManager.commit(transactionStatus);
// list.forEach(item -> {
// // 代办业务
// if(SUBMIT_TYPE_FLOW.equals(submitType)) {
// TaskV2Model taskV2Model = new TaskV2Model();
// //获取待办任务执行人
// List<AgencyUserModel> userList = Privilege.agencyUserClient
// .queryByRoleId(item.getNextExecuteIds(), null,Boolean.FALSE).getResult();
// List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
// taskV2Model.setExecuteUserIds(CollectionUtils.isEmpty(userIds)?"": String.join(",", userIds));
// taskV2Model.setExtras(JSON.toJSONString(item));
// taskV2Model.setRelationId(item.getInstanceId());
// Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
// List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
// String roleIds = String.join(",", userOrgRoleList);
// taskV2Model.setTaskType("installNotice");
// taskV2Model.setTaskTypeLabel("安装告知");
// String url = getUrl(taskV2Model.getTaskType(), "look");
// String format = String.format(url, item.getSequenceNbr(), item.getNextExecuteIds(), item.getNextExecuteIds(), item.getNoticeStatus(), item.getInstanceId());
// taskV2Model.setRoutePath(format);
// taskV2Model.setTaskTitle(item.getStatus());
// taskV2Model.setTaskName(item.getStatus());
// taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// taskV2Model.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
// taskV2Model.setTaskCode(item.getApplyNo());
// buildTaskModel(taskV2Model);
// }
// });
}
void
getNext
(
ArrayList
<
String
>
roleListFirst
,
String
instanceId
,
String
[]
taskName
)
{
AjaxResult
aj
=
Workflow
.
taskClient
.
getTaskNoAuth
(
instanceId
);
JSONObject
taskNoAuth
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
aj
.
get
(
"data"
)));
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
))
{
String
nextTaskId
=
taskNoAuth
.
getString
(
"id"
);
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
taskName
[
0
]
=
taskNoAuth
.
getString
(
"name"
);
JSONArray
data
=
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
)
datum
).
containsKey
(
"groupId"
))
{
roleListFirst
.
add
(((
Map
)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
private
void
convertField
(
JgInstallationNoticeDto
model
)
{
private
void
convertField
(
JgInstallationNoticeDto
model
)
{
// 处理图片
// 处理图片
if
(!
ValidationUtil
.
isEmpty
(
model
.
getProxyStatementAttachmentList
()))
{
if
(!
ValidationUtil
.
isEmpty
(
model
.
getProxyStatementAttachmentList
()))
{
...
@@ -666,145 +679,53 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -666,145 +679,53 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
}
}
private
String
convertImageUrl
(
List
<
Map
<
String
,
String
>>
urlList
)
{
String
urls
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
urlList
))
{
urls
=
urlList
.
stream
().
map
(
map
->
map
.
get
(
"url"
)).
collect
(
Collectors
.
joining
(
","
));
}
return
urls
;
}
public
boolean
submit
(
JgInstallationNotice
notice
,
String
op
)
{
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
notice
.
getInstanceId
());
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
String
taskId
=
dataObject
.
getString
(
"id"
);
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getProcessAdvice
()))
{
dto
.
setComment
(
notice
.
getProcessAdvice
());
}
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
)
)
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
map
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setVariable
(
map
);
//执行流程
AjaxResult
ajaxResult1
=
null
;
try
{
ajaxResult1
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
if
(
ajaxResult1
.
get
(
"code"
).
equals
(
200
))
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
return
false
;
}
}
public
void
cancel
(
JgInstallationNoticeDto
noticeDto
)
{
public
void
cancel
(
JgInstallationNoticeDto
noticeDto
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
FeignClientResult
ajaxResult
=
Workflow
.
taskV2Client
.
rollBack
(
noticeDto
.
getInstanceId
());
JgInstallationNotice
jgInstallationNotice
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
JgInstallationNotice
jgInstallationNotice
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
ProcessTaskDTO
processTaskDTO
=
iCmWorkflowService
.
rollBack
(
jgInstallationNotice
.
getInstanceId
());
if
(
ajaxResult
.
getStatus
()
==
200
)
{
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
// HashMap<String, Object> map = new HashMap<>();
// map.put("relationId", noticeDto.getInstanceId());
// map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
// map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
// map.put("isDelete", Boolean.TRUE);
// updateTaskModel(map);
getNext
(
roleList
,
noticeDto
.
getInstanceId
(),
taskName
);
jgInstallationNotice
.
setStatus
(
taskName
[
0
]);
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
jgInstallationNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
(
));
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
ROLLBACK
.
getCode
()));
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
ROLLBACK
.
getCode
()));
jgInstallationNoticeMapper
.
updateById
(
jgInstallationNotice
);
jgInstallationNotice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
}
this
.
updateById
(
jgInstallationNotice
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgInstallationNotice
));
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getCode
());
jsonObject
.
put
(
"nextExecuteUser"
,
jgInstallationNotice
.
getNextExecuteIds
());
commonService
.
rollbackTask
(
jgInstallationNotice
.
getInstanceId
(),
jsonObject
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
accept
(
JgInstallationNoticeDto
dto
,
String
op
)
{
public
void
accept
(
JgInstallationNoticeDto
dto
,
String
op
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
userId
=
RequestContext
.
getExeUserId
();
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
dto
.
getSequenceNbr
());
JgInstallationNotice
jgInstallationNotice
=
this
.
jgInstallationNoticeMapper
.
selectById
(
dto
.
getSequenceNbr
());
jgInstallationNotice
.
setProcessAdvice
(
dto
.
getProcessAdvice
());
jgInstallationNotice
.
setProcessAdvice
(
dto
.
getProcessAdvice
());
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
// 组装设备注册代码
boolean
submit
=
submit
(
jgInstallationNotice
,
op
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
// if(submit) {
//// getNext(roleList, dto.getInstanceId(),taskName);
//// jgInstallationNotice.setStatus(taskName[0]);
// if("0".equals(op)) {
// finishTask(jgInstallationNotice);
// } else {
// jgInstallationNotice.setPromoter("");
// jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
//
// HashMap<String, Object> map = new HashMap<>();
// map.put("relationId", jgInstallationNotice.getInstanceId());
// map.put("taskStatus", FlowStatusEnum.REJECTED.getCode());
// map.put("taskStatusLabel", FlowStatusEnum.REJECTED.getName());
// TaskV2Model taskV2ModelOld = updateTaskModel(map);
// TaskV2Model taskV2Model = new TaskV2Model();
// //获取待办任务执行人
// List<AgencyUserModel> userList = Privilege.agencyUserClient
// .queryByRoleId(jgInstallationNotice.getNextExecuteIds(), null,Boolean.FALSE).getResult();
// List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
// taskV2Model.setExecuteUserIds(taskV2ModelOld.getRecUserId());
// taskV2Model.setExtras(JSON.toJSONString(jgInstallationNotice));
// taskV2Model.setRelationId(jgInstallationNotice.getInstanceId());
// Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
// List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
// String roleIds = String.join(",", userOrgRoleList);
// taskV2Model.setTaskType("installNotice");
// taskV2Model.setTaskTypeLabel("安装告知");
// String url = getUrl(taskV2Model.getTaskType(), "edit");
// String format = String.format(url, jgInstallationNotice.getSequenceNbr(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNoticeStatus(), "", jgInstallationNotice.getInstanceId());
// taskV2Model.setRoutePath(format);
// taskV2Model.setTaskTitle(jgInstallationNotice.getStatus());
// taskV2Model.setTaskName(jgInstallationNotice.getStatus());
// taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// taskV2Model.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
// taskV2Model.setTaskCode(jgInstallationNotice.getApplyNo());
// buildTaskModel(taskV2Model);
// }
// jgInstallationNoticeMapper.updateById(jgInstallationNotice);
// }
}
public
void
finishTask
(
JgInstallationNotice
jgInstallationNotice
)
{
String
ym
=
null
;
String
ym
=
null
;
try
{
try
{
ym
=
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
DATE_PATTERN_MM
);
ym
=
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
DATE_PATTERN_MM
);
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
log
.
error
(
"日期转换失败:{}"
,
e
);
log
.
error
(
"日期转换失败:{}"
,
e
);
}
}
// 组装设备注册代码
// 执行工作流并返回组装好的工作流信息
StringBuffer
stringBuffer
=
new
StringBuffer
();
WorkflowResultDto
workflowResultDto
=
getWorkflowResultDto
(
op
,
jgInstallationNotice
);
jgInstallationNotice
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
if
(
"0"
.
equals
(
op
))
{
if
(
StringUtils
.
isEmpty
(
workflowResultDto
.
getNextExecutorRoleIds
()))
{
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
dto
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
OtherInfo
tzsJgOtherInfo
=
tzsJgOtherInfoMapper
.
selectOne
(
queryWrapper1
);
OtherInfo
tzsJgOtherInfo
=
tzsJgOtherInfoMapper
.
selectOne
(
queryWrapper1
);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgInstallationNotice
.
getCity
()).
append
(
ym
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgInstallationNotice
.
getCity
()).
append
(
ym
);
String
equCode
=
stringBuffer
.
toString
();
String
equCode
=
stringBuffer
.
toString
();
ResponseModel
<
String
>
responseModel
=
tzsServiceFeignClient
.
deviceRegistrationCode
(
equCode
);
ResponseModel
<
String
>
responseModel
=
tzsServiceFeignClient
.
deviceRegistrationCode
(
equCode
);
String
deviceRegistrationCode
=
responseModel
.
getResult
();
String
deviceRegistrationCode
=
responseModel
.
getResult
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -815,7 +736,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -815,7 +736,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
Map
<
String
,
Object
>
mapCode
;
Map
<
String
,
Object
>
mapCode
;
ResponseModel
<
Map
<
String
,
Object
>>
code
=
tzsServiceFeignClient
.
createCode
(
map
);
ResponseModel
<
Map
<
String
,
Object
>>
code
=
tzsServiceFeignClient
.
createCode
(
map
);
mapCode
=
code
.
getResult
();
mapCode
=
code
.
getResult
();
LambdaQueryWrapper
<
SupervisoryCodeInfo
>
queryWrapper3
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SupervisoryCodeInfo
>
queryWrapper3
=
new
LambdaQueryWrapper
<>();
queryWrapper3
.
eq
(
SupervisoryCodeInfo:
:
getSupervisoryCode
,
mapCode
.
get
(
"superviseCode"
).
toString
());
queryWrapper3
.
eq
(
SupervisoryCodeInfo:
:
getSupervisoryCode
,
mapCode
.
get
(
"superviseCode"
).
toString
());
SupervisoryCodeInfo
supervisoryCodeInfo
=
supervisoryCodeInfoMapper
.
selectOne
(
queryWrapper3
);
SupervisoryCodeInfo
supervisoryCodeInfo
=
supervisoryCodeInfoMapper
.
selectOne
(
queryWrapper3
);
...
@@ -823,9 +743,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -823,9 +743,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
supervisoryCodeInfoMapper
.
updateById
(
supervisoryCodeInfo
);
supervisoryCodeInfoMapper
.
updateById
(
supervisoryCodeInfo
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
jgInstallationNotice
.
setHandleDate
(
new
Date
());
jgInstallationNotice
.
setHandleDate
(
new
Date
());
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
// 更新其他业务表
// 更新其他业务表
if
(!
ValidationUtil
.
isEmpty
(
mapCode
.
get
(
"code96333"
)))
{
if
(!
ValidationUtil
.
isEmpty
(
mapCode
.
get
(
"code96333"
)))
{
tzsJgOtherInfo
.
setCode96333
(
mapCode
.
get
(
"code96333"
).
toString
());
tzsJgOtherInfo
.
setCode96333
(
mapCode
.
get
(
"code96333"
).
toString
());
...
@@ -840,7 +758,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -840,7 +758,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
map1
.
put
(
"SUPERVISORY_CODE"
,
tzsJgOtherInfo
.
getSupervisoryCode
());
map1
.
put
(
"SUPERVISORY_CODE"
,
tzsJgOtherInfo
.
getSupervisoryCode
());
map1
.
put
(
"USE_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getUseUnitCreditCode
());
map1
.
put
(
"USE_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getUseUnitCreditCode
());
map1
.
put
(
"USE_UNIT_NAME"
,
jgInstallationNotice
.
getUseUnitName
());
map1
.
put
(
"USE_UNIT_NAME"
,
jgInstallationNotice
.
getUseUnitName
());
map1
.
put
(
"USC_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
map1
.
put
(
"USC_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
map1
.
put
(
"USC_UNIT_NAME"
,
jgInstallationNotice
.
getInstallUnitName
());
map1
.
put
(
"USC_UNIT_NAME"
,
jgInstallationNotice
.
getInstallUnitName
());
objMap
.
put
(
tzsJgOtherInfo
.
getRecord
(),
map1
);
objMap
.
put
(
tzsJgOtherInfo
.
getRecord
(),
map1
);
...
@@ -848,7 +765,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -848,7 +765,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
tzsServiceFeignClient
.
commonUpdateEsDataByIds
(
objMap
);
tzsServiceFeignClient
.
commonUpdateEsDataByIds
(
objMap
);
tzsJgOtherInfoMapper
.
updateById
(
tzsJgOtherInfo
);
tzsJgOtherInfoMapper
.
updateById
(
tzsJgOtherInfo
);
tzsJgRegistrationInfoMapper
.
updateById
(
tzsJgRegistrationInfo
);
tzsJgRegistrationInfoMapper
.
updateById
(
tzsJgRegistrationInfo
);
// 更新施工信息表
// 更新施工信息表
IdxBizJgConstructionInfo
idxBizJgConstructionInfo
=
constructionInfoService
.
queryNewestDetailByRecord
(
jgRelationEquip
.
getEquId
());
IdxBizJgConstructionInfo
idxBizJgConstructionInfo
=
constructionInfoService
.
queryNewestDetailByRecord
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
idxBizJgConstructionInfo
))
{
if
(!
ObjectUtils
.
isEmpty
(
idxBizJgConstructionInfo
))
{
...
@@ -865,7 +781,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -865,7 +781,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
constructionInfoService
.
saveOrUpdateData
(
idxBizJgConstructionInfo
);
constructionInfoService
.
saveOrUpdateData
(
idxBizJgConstructionInfo
);
}
}
// 使用信息表更新是否西咸
// 使用信息表更新是否西咸
IdxBizJgUseInfo
useInfo
=
useInfoService
.
getOneData
(
jgRelationEquip
.
getEquId
());
IdxBizJgUseInfo
useInfo
=
useInfoService
.
getOneData
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
useInfo
))
{
if
(!
ObjectUtils
.
isEmpty
(
useInfo
))
{
...
@@ -874,155 +789,103 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -874,155 +789,103 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
useInfo
.
setIsNotXiXian
(
jgInstallationNotice
.
getIsXixian
()
==
null
?
"0"
:
jgInstallationNotice
.
getIsXixian
());
useInfo
.
setIsNotXiXian
(
jgInstallationNotice
.
getIsXixian
()
==
null
?
"0"
:
jgInstallationNotice
.
getIsXixian
());
useInfoService
.
saveOrUpdateData
(
useInfo
);
useInfoService
.
saveOrUpdateData
(
useInfo
);
}
}
}
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
public
void
buildTaskModel
(
TaskV2Model
model
){
taskMap
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
taskMap
.
put
(
"relationId"
,
jgInstallationNotice
.
getInstanceId
());
model
.
setStartDate
(
new
Date
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
model
.
setTaskSource
(
"workFlow"
);
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
model
.
setCreateDate
(
new
Date
());
taskMap
.
put
(
"model"
,
jgInstallationNotice
);
//model.setFinishStatus(Boolean.FALSE);
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
model
.
setAgencyCode
(
"tzs"
);
}
else
{
model
.
setTaskTitle
(
"发起了"
+
model
.
getTaskTitle
());
jgInstallationNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
());
Systemctl
.
taskV2Client
.
create
(
model
);
if
(!
ObjectUtils
.
isEmpty
(
jgInstallationNotice
.
getInstanceStatus
()))
{
}
jgInstallationNotice
.
setInstanceStatus
(
jgInstallationNotice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
public
TaskV2Model
updateTaskModel
(
Map
<
String
,
Object
>
params
,
JSONObject
jsonObject
){
JSONObject
userJson
=
null
;
if
(
jsonObject
!=
null
){
userJson
=
JSON
.
parseObject
(
jsonObject
.
get
(
"user"
).
toString
());
}
List
<
TaskV2Model
>
result
=
Systemctl
.
taskV2Client
.
selectListByRelationId
(
params
.
get
(
"relationId"
).
toString
()).
getResult
();
TaskV2Model
model
=
result
.
stream
().
min
((
r1
,
r2
)
->
r2
.
getSequenceNbr
().
compareTo
(
r1
.
getSequenceNbr
()))
.
orElse
(
null
);
if
(
model
==
null
){
return
null
;
}
model
.
setTaskStatus
(
Integer
.
valueOf
(
params
.
get
(
"taskStatus"
).
toString
()));
model
.
setRoutePath
(
model
.
getRoutePath
().
replace
(
"nextExecuteIds"
,
"nextExecuteIdsOld"
));
model
.
setTaskStatusLabel
(
params
.
get
(
"taskStatusLabel"
).
toString
());
model
.
setEndDate
(
new
Date
());
//model.setFinishStatus(Boolean.TRUE);
model
.
setEndUserId
(
userJson
!=
null
?
userJson
.
get
(
"userId"
).
toString
()
:
""
);
if
(
params
.
containsKey
(
"isDelete"
))
{
Systemctl
.
taskV2Client
.
delete
(
model
.
getSequenceNbr
().
toString
());
}
else
{
}
else
{
Systemctl
.
taskV2Client
.
update
(
model
,
model
.
getSequenceNbr
());
jgInstallationNotice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskMap
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskMap
.
put
(
"relationId"
,
jgInstallationNotice
.
getInstanceId
());
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
jgInstallationNotice
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
workflowResultDto
.
getNextTaskId
());
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
return
model
;
}
else
{
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
jgInstallationNotice
.
getNoticeStatus
());
taskMap
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
REJECTED
.
getName
());
taskMap
.
put
(
"relationId"
,
jgInstallationNotice
.
getInstanceId
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
REJECTED
.
getCode
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
REJECTED
.
getName
());
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
jgInstallationNotice
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
REJECTED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
REJECTED
.
getName
());
taskModelDto
.
setFlowCode
(
workflowResultDto
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
jgInstallationNotice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
this
.
updateById
(
jgInstallationNotice
);
}
}
private
String
getUrl
(
String
type
,
String
pageType
)
{
String
json
=
null
;
try
{
json
=
IOUtils
.
toString
(
bizTypeInfo
.
getInputStream
(),
java
.
lang
.
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
<
Map
>
list
=
parseArray
(
json
,
Map
.
class
);
String
url
=
null
;
for
(
Map
map
:
list
)
{
if
(
map
.
get
(
"type"
).
equals
(
type
)&&
pageType
.
equals
(
map
.
get
(
"pageType"
))){
url
=
map
.
get
(
"url"
).
toString
();
break
;
}
}
return
url
;
}
public
void
updateByWorkFlow
(
JSONObject
jsonObject
)
{
String
businessKey
=
jsonObject
.
getString
(
"businessKey"
);
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
businessKey
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"candidateGroups"
);
JSONArray
executor
=
parseArray
(
jsonObject
.
get
(
"executor"
).
toString
());
List
<
String
>
userList
=
new
ArrayList
<>();
for
(
Object
datum
:
executor
)
{
if
(((
Map
)
datum
).
containsKey
(
"userId"
))
{
userList
.
add
(((
Map
)
datum
).
get
(
"userId"
).
toString
());
}
}
String
userIds
=
String
.
join
(
","
,
userList
);
jgInstallationNotice
.
setInstanceId
(
jsonObject
.
get
(
"processInstanceId"
).
toString
());
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
list
));
jgInstallationNotice
.
setInstanceStatus
(
jgInstallationNotice
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
list
));
jgInstallationNotice
.
setStatus
(
jsonObject
.
get
(
"nodeName"
).
toString
());
FlowStatusEnum
noticeStatus
=
this
.
buildNoticeStatus
(
jgInstallationNotice
.
getApprovalStatus
());
jgInstallationNotice
.
setNoticeStatus
(
noticeStatus
.
getCode
()
+
""
);
this
.
updateById
(
jgInstallationNotice
);
if
(!
"撤回"
.
equals
(
jgInstallationNotice
.
getApprovalStatus
()))
{
/**
// 创建待办
* 执行工作流并返回组装好的工作流信息
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
* @param op 是否通过
taskV2Model
.
setExecuteUserIds
(
userIds
);
* @param jgTransferNotice 业务信息 opinion 备注信息
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
jgInstallationNotice
));
* @return 返回组装好的工作流信息
taskV2Model
.
setRelationId
(
jgInstallationNotice
.
getInstanceId
());
*/
taskV2Model
.
setTaskType
(
"installNotice"
);
private
WorkflowResultDto
getWorkflowResultDto
(
String
op
,
JgInstallationNotice
jgTransferNotice
)
{
taskV2Model
.
setTaskTypeLabel
(
"安装告知"
);
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
String
url
=
getUrl
(
taskV2Model
.
getTaskType
(),
"look"
);
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
String
format
=
String
.
format
(
url
,
jgInstallationNotice
.
getSequenceNbr
(),
jgInstallationNotice
.
getNextExecuteIds
(),
jgInstallationNotice
.
getNextExecuteIds
(),
jgInstallationNotice
.
getNoticeStatus
(),
jgInstallationNotice
.
getInstanceId
());
// 只调用执行API,返回下个节点信息,用于填充业务字段
taskV2Model
.
setRoutePath
(
format
);
//组装信息
taskV2Model
.
setTaskTitle
(
jgInstallationNotice
.
getStatus
());
TaskResultDTO
workDto
=
new
TaskResultDTO
();
taskV2Model
.
setTaskName
(
jgInstallationNotice
.
getStatus
());
workDto
.
setResultCode
(
"approvalStatus"
);
taskV2Model
.
setTaskStatus
(
noticeStatus
.
getCode
());
workDto
.
setTaskId
(
jgTransferNotice
.
getNextTaskId
());
taskV2Model
.
setTaskStatusLabel
(
noticeStatus
.
getName
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
taskV2Model
.
setTaskCode
(
jgInstallationNotice
.
getApplyNo
());
if
(
jgTransferNotice
.
getNoticeStatus
().
equals
(
"6614"
)
||
jgTransferNotice
.
getNoticeStatus
().
equals
(
"6615"
))
{
taskV2Model
.
setStartUserId
(
jgInstallationNotice
.
getCreateUserId
());
commMap
.
put
(
"approvalStatus"
,
"提交"
);
//taskV2Model.setCreateUserId(jgInstallationNotice.getCreateUserId());
buildTaskModel
(
taskV2Model
);
}
}
private
FlowStatusEnum
buildNoticeStatus
(
String
approvalStatus
){
if
(
"提交"
.
equals
(
approvalStatus
)){
return
FlowStatusEnum
.
TO_BE_PROCESSED
;
}
else
if
(
"驳回"
.
equals
(
approvalStatus
)
||
"1"
.
equals
(
approvalStatus
)){
return
FlowStatusEnum
.
REJECTED
;
}
else
if
(
"通过"
.
equals
(
approvalStatus
)
||
"0"
.
equals
(
approvalStatus
)){
return
FlowStatusEnum
.
TO_BE_FINISHED
;
}
else
{
}
else
{
return
FlowStatusEnum
.
ROLLBACK
;
commMap
.
put
(
"approvalStatus"
,
op
)
;
}
}
workDto
.
setVariable
(
commMap
);
workDto
.
setComment
(
jgTransferNotice
.
getProcessAdvice
());
processTaskDTO
=
iCmWorkflowService
.
complete
(
jgTransferNotice
.
getNextTaskId
(),
workDto
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
return
workflowResultDto
;
}
}
public
void
completeWorkFlow
(
String
approvalStatus
,
JSONObject
jsonObject
)
{
// 1.更新业务字段
String
businessKey
=
jsonObject
.
getString
(
"businessKey"
);
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
businessKey
);
jgInstallationNotice
.
setInstanceId
(
jsonObject
.
get
(
"processInstanceId"
).
toString
());
}
jgInstallationNotice
.
setStatus
(
jsonObject
.
get
(
"nodeName"
).
toString
());
jgInstallationNotice
.
setApprovalStatus
(
approvalStatus
);
FlowStatusEnum
noticeStatus
=
this
.
buildNoticeStatus
(
jgInstallationNotice
.
getApprovalStatus
());
jgInstallationNotice
.
setNoticeStatus
(
noticeStatus
.
getCode
()
+
""
);
this
.
updateById
(
jgInstallationNotice
);
if
(
"撤回"
.
equals
(
approvalStatus
))
{
// 删除待办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"relationId"
,
jgInstallationNotice
.
getInstanceId
());
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
map
.
put
(
"isDelete"
,
Boolean
.
TRUE
);
updateTaskModel
(
map
,
jsonObject
);
}
else
{
// 更新代办为已完成及更新url
List
<
TaskV2Model
>
result
=
Systemctl
.
taskV2Client
.
selectListByRelationId
(
jgInstallationNotice
.
getInstanceId
()).
getResult
();
// 按时间降序排序
TaskV2Model
model
=
result
.
stream
().
min
((
r1
,
r2
)
->
r2
.
getSequenceNbr
().
compareTo
(
r1
.
getSequenceNbr
()))
.
orElse
(
null
);
if
(
model
==
null
)
{
return
;
}
String
url
=
getUrl
(
model
.
getTaskType
(),
"look"
);
String
format
=
String
.
format
(
url
,
jgInstallationNotice
.
getSequenceNbr
(),
jgInstallationNotice
.
getNextExecuteIds
(),
jgInstallationNotice
.
getNextExecuteIds
(),
jgInstallationNotice
.
getNoticeStatus
(),
jgInstallationNotice
.
getInstanceId
());
model
.
setRoutePath
(
format
);
model
.
setRoutePath
(
model
.
getRoutePath
().
replace
(
"nextExecuteIds"
,
"nextExecuteIdsOld"
));
model
.
setTaskStatusLabel
(
jsonObject
.
get
(
"nodeName"
).
toString
());
model
.
setEndDate
(
new
Date
());
//model.setFinishStatus(Boolean.TRUE);
JSONObject
userJson
=
JSON
.
parseObject
(
jsonObject
.
get
(
"user"
).
toString
());
model
.
setEndUserId
(
userJson
.
get
(
"userId"
).
toString
());
Systemctl
.
taskV2Client
.
update
(
model
,
model
.
getSequenceNbr
());
}
}
}
\ 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/JgTransferNoticeServiceImpl.java
View file @
e84ef003
...
@@ -592,7 +592,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -592,7 +592,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgInstallationNotice
));
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgInstallationNotice
));
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_ADVICE_REMOVAL
.
getCode
());
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_ADVICE_REMOVAL
.
getCode
());
jsonObject
.
put
(
"nextExecuteUser"
,
jgInstallationNotice
.
getNextExecuteIds
());
jsonObject
.
put
(
"nextExecuteUser"
,
jgInstallationNotice
.
getNextExecuteIds
());
commonService
.
rollbackTask
(
jgInstallationNotice
.
getInstanceId
(),
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgInstallationNotice
))
);
commonService
.
rollbackTask
(
jgInstallationNotice
.
getInstanceId
(),
jsonObject
);
}
}
@Transactional
@Transactional
...
@@ -633,6 +633,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -633,6 +633,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
taskMap
.
put
(
"relationId"
,
jgTransferNotice
.
getInstanceId
());
taskMap
.
put
(
"relationId"
,
jgTransferNotice
.
getInstanceId
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
taskMap
.
put
(
"model"
,
jgTransferNotice
);
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
}
else
{
}
else
{
jgTransferNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
());
jgTransferNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
());
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/json/urlInfo.json
View file @
e84ef003
...
@@ -9,13 +9,13 @@
...
@@ -9,13 +9,13 @@
"type"
:
"102"
,
"type"
:
"102"
,
"pageType"
:
"look"
,
"pageType"
:
"look"
,
"name"
:
"安装告知"
,
"name"
:
"安装告知"
,
"url"
:
"/mixuap?appId=1742358052905971713&id=1735246137364869121&
sequenceNbr=%s&roleIds=%s&&userId={userId}&nextExecuteIds=%s&formType=detail¬iceStatus=%s&instanceId=%s
"
"url"
:
"/mixuap?appId=1742358052905971713&id=1735246137364869121&
roleIds={roleIds}&userId={userId}&formType=detail
"
},
},
{
{
"type"
:
"102"
,
"type"
:
"102"
,
"pageType"
:
"edit"
,
"pageType"
:
"edit"
,
"name"
:
"安装告知"
,
"name"
:
"安装告知"
,
"url"
:
"
/mixuap?appId=1742358052905971713&id=1734127099570057217&sequenceNbr=%s&roleIds=%s&userId={userId}&nextExecuteIds=%s&formType=edit¬iceStatus=%s&instanceId=%s
"
"url"
:
""
},
},
{
{
"type"
:
"103"
,
"type"
:
"103"
,
...
...
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