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
ffc4c36e
Commit
ffc4c36e
authored
Jan 10, 2024
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移装告知新开发
parent
991b59ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
222 additions
and
227 deletions
+222
-227
JgTransferNoticeDto.java
...join/amos/boot/module/jg/api/dto/JgTransferNoticeDto.java
+5
-0
JgTransferNotice.java
...join/amos/boot/module/jg/api/entity/JgTransferNotice.java
+7
-0
JgTransferNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
+210
-227
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/JgTransferNoticeDto.java
View file @
ffc4c36e
...
...
@@ -214,4 +214,9 @@ public class JgTransferNoticeDto extends BaseDto {
private
String
noticeReportUrl
;
private
String
createUserCompanyName
;
//下一步任务ID
private
String
nextTaskId
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgTransferNotice.java
View file @
ffc4c36e
...
...
@@ -298,4 +298,11 @@ public class JgTransferNotice extends BaseEntity {
@TableField
(
value
=
"handle_date"
)
private
Date
handleDate
;
@TableField
(
value
=
"create_user_company_name"
)
private
String
createUserCompanyName
;
//下一步任务ID
@TableField
(
value
=
"next_taskId"
)
private
String
nextTaskId
;
}
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 @
ffc4c36e
...
...
@@ -2,20 +2,16 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.aspose.words.SaveFormat
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
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.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto
;
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.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
...
...
@@ -23,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
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.utils.ImageUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo
;
...
...
@@ -30,32 +27,23 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseUnitLicence;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.
AjaxResult
;
import
com.yeejoin.amos.feign.workflow.model.
ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
jdk.nashorn.api.scripting.JSObject
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.function.Function
;
...
...
@@ -68,7 +56,7 @@ import java.util.stream.Collectors;
* @date 2023-12-19
*/
@Service
public
class
JgTransferNoticeServiceImpl
extends
BaseService
<
JgTransferNoticeDto
,
JgTransferNotice
,
JgTransferNoticeMapper
>
implements
IJgTransferNoticeService
{
public
class
JgTransferNoticeServiceImpl
extends
BaseService
<
JgTransferNoticeDto
,
JgTransferNotice
,
JgTransferNoticeMapper
>
implements
IJgTransferNoticeService
{
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
PROCESS_DEFINITION_KEY
=
"transferNotice"
;
...
...
@@ -82,6 +70,11 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
private
JgTransferNoticeMapper
jgTransferNoticeMapper
;
@Autowired
RegistrationInfoMapper
tzsJgRegistrationInfoMapper
;
@Autowired
private
CommonServiceImpl
commonService
;
@Autowired
OtherInfoMapper
tzsJgOtherInfoMapper
;
@Autowired
...
...
@@ -94,6 +87,9 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@Autowired
private
TzBaseUnitLicenceMapper
baseUnitLicenceMapper
;
@Autowired
ICmWorkflowService
iCmWorkflowService
;
/**
* 根据sequenceNbr查询
*
...
...
@@ -113,10 +109,10 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
transferNotice
.
put
(
"county"
,
notice
.
getCounty
()
+
"_"
+
notice
.
getCountyName
());
transferNotice
.
put
(
"useUnitCreditCode"
,
notice
.
getUseUnitCreditCode
()
+
"_"
+
notice
.
getUseUnitName
());
transferNotice
.
put
(
"receiveOrgCode"
,
notice
.
getReceiveOrgCode
()
+
"_"
+
notice
.
getReceiveOrgName
());
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getFactoryUseSiteStreet
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getStreetName
()))
{
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getFactoryUseSiteStreet
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getStreetName
()))
{
transferNotice
.
put
(
"factoryUseSiteStreet"
,
notice
.
getFactoryUseSiteStreet
()
+
"_"
+
notice
.
getStreetName
());
}
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getConstructionManagerId
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getConstructionManager
()))
{
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getConstructionManagerId
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getConstructionManager
()))
{
transferNotice
.
put
(
"constructionManagerId"
,
notice
.
getConstructionManagerId
()
+
"_"
+
notice
.
getConstructionManager
());
}
String
[]
fields
=
{
"productPhoto"
,
"designDoc"
,
"designStandard"
,
"factoryStandard"
,
...
...
@@ -251,49 +247,85 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
this
.
convertField
(
noticeDto
);
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
AjaxResult
ajaxResult
;
// 发起流程
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
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
"1"
);
try
{
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
noticeDto
.
setInstanceId
(
instanceId
);
// 查询下节点任务
getNext
(
roleListFirst
,
instanceId
,
taskName
);
noticeDto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
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
());
}
}
JgTransferNotice
notice
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
boolean
submit
=
submit
(
notice
,
op
,
null
);
if
(
submit
)
{
// 查询下节点任务
getNext
(
roleListSecond
,
notice
.
getInstanceId
(),
taskName
);
notice
.
setStatus
(
taskName
[
0
]);
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
jgTransferNoticeMapper
.
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
);
processTaskDTO
=
iCmWorkflowService
.
complete
(
notice
.
getNextTaskId
(),
dto
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListSecond
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
()
);
}
else
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListSecond
));
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
(
));
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()
));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
jgTransferNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
commonService
.
getDictionaryCodeByName
(
notice
.
getNoticeStatus
()));
map
.
put
(
"taskStatusLabel"
,
notice
.
getNoticeStatus
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
notice
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
else
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
...
...
@@ -306,7 +338,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
/**
* 分页查询
*/
public
Page
<
JgTransferNoticeDto
>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
public
Page
<
JgTransferNoticeDto
>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
String
orgCode
;
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
model
.
setReceiveOrgCode
(
orgCode
);
...
...
@@ -329,39 +361,28 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
return
noticeDtoPage
;
}
/**
* 列表查询 示例
*/
public
List
<
JgTransferNoticeDto
>
queryForJgTransferNoticeList
()
{
return
this
.
queryForList
(
""
,
false
);
}
@Override
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgTransferNoticeDtoMap
,
ReginParams
reginParams
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
).
toString
(),
JgTransferNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
;
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
return
;
}
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
// 判断当前是否为提交
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
workFlowInfo
(
submitType
,
taskName
,
deviceList
,
roleListFirst
,
roleListSecond
,
instanceIdList
);
// 启动工作流并返回信息
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
);
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
...
...
@@ -369,16 +390,17 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
JgTransferNoticeEq
jgRelationEquip
=
new
JgTransferNoticeEq
();
JgTransferNotice
dto
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
responseModel
.
getResult
().
get
(
i
);
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
dto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
workflowResultList
.
get
(
i
).
getNextExecutorRoleIds
(
));
dto
.
setInstanceStatus
(
workflowResultList
.
get
(
i
).
getNextExecutorRoleIds
()
+
","
+
workflowResultList
.
get
(
i
).
getExecutorRoleIds
(
));
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
set
Status
(
taskName
[
0
]
);
dto
.
set
NextTaskId
(
workflowResultList
.
get
(
i
).
getNextTaskId
()
);
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
...
...
@@ -395,8 +417,9 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
});
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
// 如果为保存并提交,则创建代办
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
);
buildTask
(
list
,
workflowResultList
);
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
...
...
@@ -408,96 +431,61 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
@Autowired
private
CommonServiceImpl
commonService
;
private
void
buildTask
(
List
<
JgTransferNotice
>
list
)
{
/**
* 插入代办
*/
private
void
buildTask
(
List
<
JgTransferNotice
>
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(
); // 工作流API返回
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(
); // 工作流API返回
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
()
);
// 工作流API返回
taskModelDto
.
setTaskStatus
(
commonService
.
getDictionaryCodeByName
(
item
.
getNoticeStatus
()));
// 流程状态枚举
taskModelDto
.
setTaskStatusLabel
(
item
.
getNoticeStatus
());
taskModelDto
.
setStartUserId
(
item
.
getCreateUserId
());
taskModelDto
.
setStartUser
(
item
.
get
Rec
UserName
());
// taskModelDto.setStartUserCompanyName(
); // 任务发起人所在单位
taskModelDto
.
setStartUser
(
item
.
get
Create
UserName
());
taskModelDto
.
setStartUserCompanyName
(
item
.
getCreateUserCompanyName
()
);
// 任务发起人所在单位
taskModelDto
.
setStartDate
(
item
.
getCreateDate
());
taskModelDto
.
setModel
(
item
);
taskModelDto
.
setNextExecuteUser
(
item
.
getNextExecuteIds
());
taskModelDtoList
.
add
(
taskModelDto
);
});
commonService
.
buildTaskModel
(
taskModelDtoList
);
}
private
void
workFlowInfo
(
String
submitType
,
String
[]
taskName
,
List
<
Map
<
String
,
Object
>>
deviceList
,
ArrayList
<
String
>
roleListFirst
,
ArrayList
<
String
>
roleListSecond
,
List
<
String
>
instanceId
List
)
{
private
List
<
WorkflowResultDto
>
workFlowInfo
(
String
submitType
,
List
<
Map
<
String
,
Object
>>
device
List
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++)
{
deviceList
.
forEach
(
item
->
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
i
));
// dto.setCompleteFirstTask(true
);
dto
.
setBusinessKey
(
item
.
get
(
"SEQUENCE_NBR"
).
toString
(
));
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
list
.
add
(
dto
);
}
}
);
actWorkflowBatchDTO
.
setProcess
(
list
);
try
{
FeignClientResult
result
=
Workflow
.
taskV2Client
.
startByVariableBatch
(
actWorkflowBatchDTO
);
List
<
Object
>
returnList
=
(
List
<
Object
>)
result
.
getResult
();
for
(
Object
obj
:
returnList
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
obj
));
String
instanceId
=
jsonObject
.
getString
(
"id"
);
instanceIdList
.
add
(
instanceId
);
// 查询下节点任务
if
(
returnList
.
get
(
0
).
equals
(
obj
))
{
getNext
(
roleListFirst
,
instanceId
,
taskName
);
}
// 推动下一个节点
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
String
taskId
=
dataObject
.
getString
(
"id"
);
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
dto
.
setComment
(
"提交流程"
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
"0"
);
dto
.
setVariable
(
map
);
//执行流程
AjaxResult
ajaxResult1
=
null
;
try
{
ajaxResult1
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
if
(
ajaxResult1
.
get
(
"code"
).
equals
(
200
))
{
getNext
(
roleListSecond
,
instanceId
,
taskName
);
}
else
{
log
.
error
(
"提交失败"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
List
<
ProcessTaskDTO
>
processTaskDTOS
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
);
// 组装工作流返回的数据
return
commonService
.
buildWorkFlowInfo
(
processTaskDTOS
);
}
return
new
ArrayList
<>();
}
private
void
convertField
(
JgTransferNoticeDto
model
)
{
// 处理图片
if
(!
ValidationUtil
.
isEmpty
(
model
.
getConstructionContractList
()))
{
if
(!
ValidationUtil
.
isEmpty
(
model
.
getConstructionContractList
()))
{
model
.
setConstructionContract
(
JSON
.
toJSONString
(
model
.
getConstructionContractList
()));
}
if
(!
ValidationUtil
.
isEmpty
(
model
.
getPowerOfAttorneyList
()))
{
if
(!
ValidationUtil
.
isEmpty
(
model
.
getPowerOfAttorneyList
()))
{
model
.
setPowerOfAttorney
(
JSON
.
toJSONString
(
model
.
getPowerOfAttorneyList
()));
}
...
...
@@ -567,67 +555,23 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
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
(
JgTransferNotice
notice
,
String
op
,
String
opinion
)
{
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
(!
StringUtils
.
isEmpty
(
opinion
))
{
dto
.
setComment
(
opinion
);
}
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
(
JgTransferNoticeDto
noticeDto
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
FeignClientResult
ajaxResult
=
Workflow
.
taskV2Client
.
rollBack
(
noticeDto
.
getInstanceId
());
JgTransferNotice
jgInstallationNotice
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
ArrayList
<
String
>
roleList
=
new
ArrayList
<>(
);
if
(
ajaxResult
.
getStatus
()
==
200
)
{
getNext
(
roleList
,
noticeDto
.
getInstanceId
(),
taskName
);
jgInstallationNotice
.
setStatus
(
taskName
[
0
]
);
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
ROLLBACK
.
getCode
())
);
jgTransferNoticeMapper
.
updateById
(
jgInstallationNotice
);
}
ProcessTaskDTO
processTaskDTO
=
iCmWorkflowService
.
rollBack
(
jgInstallationNotice
.
getInstanceId
()
);
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
()
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
ROLLBACK
.
getCode
()
));
jgTransferNoticeMapper
.
updateById
(
jgInstallationNotice
);
commonService
.
deleteTaskModel
(
jgInstallationNotice
.
getInstanceId
()
);
commonService
.
rollbackTask
(
jgInstallationNotice
.
getInstanceId
());
}
@Transactional
public
void
accept
(
JgTransferNoticeDto
dto
,
String
op
,
String
opinion
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
JgTransferNotice
jgTransferNotice
=
this
.
jgTransferNoticeMapper
.
selectById
(
dto
.
getSequenceNbr
());
// 组装设备注册代码
...
...
@@ -639,59 +583,97 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
log
.
error
(
"日期转换失败:{}"
,
e
);
}
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
boolean
submit
=
submit
(
jgTransferNotice
,
op
,
opinion
);
if
(
submit
)
{
getNext
(
roleList
,
dto
.
getInstanceId
(),
taskName
);
jgTransferNotice
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
if
(
"0"
.
equals
(
op
))
{
if
(
roleList
.
size
()
==
0
)
{
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
dto
.
getSequenceNbr
());
JgTransferNoticeEq
jgTransferNoticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgTransferNoticeEq
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgTransferNotice
.
getCity
()).
append
(
ym
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cityCode"
,
jgTransferNotice
.
getCity
());
map
.
put
(
"countyCode"
,
jgTransferNotice
.
getCounty
());
map
.
put
(
"equCategory"
,
tzsJgRegistrationInfo
.
getEquCategory
());
jgTransferNotice
.
setPromoter
(
""
);
jgTransferNotice
.
setHandleDate
(
new
Date
());
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
this
.
generateTransferNoticeReport
(
jgTransferNotice
.
getSequenceNbr
());
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
workDto
=
new
TaskResultDTO
();
workDto
.
setResultCode
(
"approvalStatus"
);
workDto
.
setTaskId
(
jgTransferNotice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
jgTransferNotice
.
getNoticeStatus
().
equals
(
"6614"
)
||
jgTransferNotice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
workDto
.
setVariable
(
commMap
);
processTaskDTO
=
iCmWorkflowService
.
complete
(
jgTransferNotice
.
getNextTaskId
(),
workDto
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
jgTransferNotice
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
if
(
"0"
.
equals
(
op
))
{
if
(
StringUtils
.
isEmpty
(
workflowResultDto
.
getNextExecutorRoleIds
()))
{
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
dto
.
getSequenceNbr
());
JgTransferNoticeEq
jgTransferNoticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgTransferNoticeEq
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgTransferNotice
.
getCity
()).
append
(
ym
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cityCode"
,
jgTransferNotice
.
getCity
());
map
.
put
(
"countyCode"
,
jgTransferNotice
.
getCounty
());
map
.
put
(
"equCategory"
,
tzsJgRegistrationInfo
.
getEquCategory
());
jgTransferNotice
.
setPromoter
(
""
);
jgTransferNotice
.
setHandleDate
(
new
Date
());
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
this
.
generateTransferNoticeReport
(
jgTransferNotice
.
getSequenceNbr
());
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
commonService
.
getDictionaryCodeByName
(
jgTransferNotice
.
getNoticeStatus
()));
taskMap
.
put
(
"taskStatusLabel"
,
jgTransferNotice
.
getNoticeStatus
());
taskMap
.
put
(
"relationId"
,
jgTransferNotice
.
getInstanceId
());
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
}
else
{
jgTransferNotice
.
setNextExecuteIds
(
workflowResultDto
.
getNextExecutorRoleIds
());
if
(!
ObjectUtils
.
isEmpty
(
jgTransferNotice
.
getInstanceStatus
()))
{
jgTransferNotice
.
setInstanceStatus
(
jgTransferNotice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
jgTransferNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
if
(!
ObjectUtils
.
isEmpty
(
jgTransferNotice
.
getInstanceStatus
()))
{
jgTransferNotice
.
setInstanceStatus
(
jgTransferNotice
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
roleList
));
}
else
{
jgTransferNotice
.
setInstanceStatus
(
String
.
join
(
","
,
roleList
));
}
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
jgTransferNotice
.
setInstanceStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
jgTransferNotice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
}
else
{
jgTransferNotice
.
setPromoter
(
""
);
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
commonService
.
getDictionaryCodeByName
(
jgTransferNotice
.
getNoticeStatus
()));
taskMap
.
put
(
"taskStatusLabel"
,
jgTransferNotice
.
getNoticeStatus
());
taskMap
.
put
(
"relationId"
,
jgTransferNotice
.
getInstanceId
());
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
jgTransferNotice
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
jgTransferNoticeMapper
.
updateById
(
jgTransferNotice
);
}
else
{
jgTransferNotice
.
setPromoter
(
""
);
jgTransferNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
// 上个代办改为已办
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
commonService
.
getDictionaryCodeByName
(
jgTransferNotice
.
getNoticeStatus
()));
taskMap
.
put
(
"taskStatusLabel"
,
jgTransferNotice
.
getNoticeStatus
());
taskMap
.
put
(
"relationId"
,
jgTransferNotice
.
getInstanceId
());
taskV2Model
=
commonService
.
updateTaskModel
(
taskMap
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
jgTransferNotice
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
jgTransferNoticeMapper
.
updateById
(
jgTransferNotice
);
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
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
)
datum
).
containsKey
(
"groupId"
))
{
roleListFirst
.
add
(((
Map
)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
}
\ No newline at end of file
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