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
269d0da3
Commit
269d0da3
authored
Jan 11, 2024
by
刘凡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移装变更登记,流程操作代码修改
parent
03a9f2a9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
276 additions
and
138 deletions
+276
-138
JgChangeRegistrationTransfer.java
...ot/module/jg/api/entity/JgChangeRegistrationTransfer.java
+32
-2
JgChangeRegistrationTransferMapper.java
...ule/jg/api/mapper/JgChangeRegistrationTransferMapper.java
+4
-0
JgChangeRegistrationTransferController.java
...iz/controller/JgChangeRegistrationTransferController.java
+2
-2
JgChangeRegistrationTransferServiceImpl.java
...service/impl/JgChangeRegistrationTransferServiceImpl.java
+238
-134
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/entity/JgChangeRegistrationTransfer.java
View file @
269d0da3
...
...
@@ -122,13 +122,19 @@ public class JgChangeRegistrationTransfer extends BaseEntity {
/**
* 创建人ID
*/
@TableField
(
value
=
"create_user_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
value
=
"create_user_id"
)
private
String
createUserId
;
/**
* 创建人名称
*/
@TableField
(
"create_user_name"
)
private
String
createUserName
;
/**
* 创建时间
*/
@TableField
(
value
=
"create_date"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
value
=
"create_date"
)
private
Date
createDate
;
/**
...
...
@@ -198,8 +204,32 @@ public class JgChangeRegistrationTransfer extends BaseEntity {
private
String
promoter
;
/**
* 使用登记证书附件
*/
@TableField
(
"use_registration_certificate"
)
private
String
useRegistrationCertificate
;
/**
* 流程状态
*/
@TableField
(
"instance_status"
)
private
String
instanceStatus
;
/**
*工作流下一节点任务id
*/
@TableField
(
value
=
"next_task_id"
)
private
String
nextTaskId
;
/**
* 创建单位名称
*/
@TableField
(
value
=
"create_user_company_name"
)
private
String
createUserCompanyName
;
/**
* 设备种类名称
*/
@TableField
(
value
=
"equip_list_name"
)
private
String
equipListName
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgChangeRegistrationTransferMapper.java
View file @
269d0da3
...
...
@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransfer
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -20,4 +21,7 @@ public interface JgChangeRegistrationTransferMapper extends BaseMapper<JgChangeR
void
updatePromoter
(
@Param
(
"id"
)
Long
id
);
Page
<
Map
<
String
,
Object
>>
getListPage
(
@Param
(
"page"
)
Page
<
Map
<
String
,
Object
>>
page
,
@Param
(
"dto"
)
JgChangeRegistrationTransferDto
dto
,
@Param
(
"roleIds"
)
List
<
String
>
roleIds
);
@Select
(
"select name from tz_equipment_category where code=#{code}"
)
String
getEquiplistNameByEquiplist
(
String
code
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationTransferController.java
View file @
269d0da3
...
...
@@ -55,7 +55,7 @@ public class JgChangeRegistrationTransferController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增移装变更登记登记"
,
notes
=
"新增移装变更登记登记"
)
public
ResponseModel
<
Boolean
>
save
(
@RequestParam
(
value
=
"submitType"
,
required
=
false
)
String
submitType
,
public
ResponseModel
<
Boolean
>
save
(
@RequestParam
(
value
=
"submitType"
)
String
submitType
,
@RequestBody
JSONObject
map
)
{
Map
<
String
,
Object
>
tableData
=
(
Map
<
String
,
Object
>)
map
.
get
(
TABLE_PAGE_ID
);
if
(
ValidationUtil
.
isEmpty
(
tableData
)){
...
...
@@ -78,7 +78,7 @@ public class JgChangeRegistrationTransferController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新移装变更登记登记"
,
notes
=
"根据sequenceNbr更新移装变更登记登记"
)
public
ResponseModel
<
Boolean
>
updateBySequenceNbr
(
@RequestParam
(
value
=
"submitType"
,
required
=
false
)
String
submitType
,
public
ResponseModel
<
Boolean
>
updateBySequenceNbr
(
@RequestParam
(
value
=
"submitType"
)
String
submitType
,
@RequestBody
JSONObject
map
)
{
Map
<
String
,
Object
>
tableData
=
(
Map
<
String
,
Object
>)
map
.
get
(
TABLE_PAGE_ID
);
if
(
ValidationUtil
.
isEmpty
(
tableData
)){
...
...
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/JgChangeRegistrationTransferServiceImpl.java
View file @
269d0da3
...
...
@@ -9,9 +9,13 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
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.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationReform
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransfer
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransferEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.UseStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
...
...
@@ -26,6 +30,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransfer
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgRegistrationHistoryService
;
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.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService
;
import
com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService
;
...
...
@@ -38,10 +43,12 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
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
com.yeejoin.amos.feign.workflow.model.*
;
import
fr.opensagres.xdocreport.core.io.IOUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
...
...
@@ -50,8 +57,12 @@ import org.elasticsearch.client.RestHighLevelClient;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -62,18 +73,15 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
.
BusinessTypeEnum
.
JG_CHANGE_REGISTRATION
;
/**
* 移装变更登记登记服务实现类
*
...
...
@@ -131,11 +139,18 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
private
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
@Autowired
ICommonService
c
ommonService
;
ICommonService
iC
ommonService
;
@Autowired
TzsServiceFeignClient
tzsServiceFeignClient
;
@Autowired
ICmWorkflowService
icmWorkflowService
;
@Autowired
CommonServiceImpl
commonService
;
@Value
(
"classpath:/json/urlInfo.json"
)
private
Resource
bizTypeInfo
;
/**
* 新增移装变更登记
*
...
...
@@ -146,11 +161,11 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
public
boolean
createTransfer
(
String
submitType
,
JSONObject
map
,
ReginParams
reginParams
)
{
Map
<
String
,
Object
>
tableData
=
(
Map
<
String
,
Object
>)
map
.
get
(
TABLE_PAGE_ID
);
if
(
ValidationUtil
.
isEmpty
(
tableData
))
{
if
(
ValidationUtil
.
isEmpty
(
tableData
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
String
equIds
=
(
String
)
tableData
.
get
(
"record"
);
if
(
ValidationUtil
.
isEmpty
(
equIds
))
{
if
(
ValidationUtil
.
isEmpty
(
equIds
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
CompanyBo
company
=
reginParams
.
getCompany
();
...
...
@@ -207,7 +222,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
oldTransfer
.
setUseUnitName
(
company
.
getCompanyName
());
//录入单位统一信用代码
oldTransfer
.
setInputUnitNo
(
company
.
getCompanyCode
());
// 创建人ID
oldTransfer
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
//登记机构代码
//登记机构公司代码
...
...
@@ -298,21 +314,25 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(
map
.
containsKey
(
"instanceId"
))
{
instanceId
=
map
.
get
(
"instanceId"
).
toString
();
}
else
{
// 启动并执行流程
instanceId
=
startByVariable
();
this
.
updateExecuteIds
(
instanceId
,
oldTransfer
.
getSequenceNbr
(),
"0"
);
// 如果是新启动的流程开启自动访问
String
equipListName
=
this
.
getBaseMapper
().
getEquiplistNameByEquiplist
(
Optional
.
ofNullable
(
map
.
get
(
"equList"
).
toString
()).
orElse
(
" "
));
oldTransfer
.
setEquipListName
(
equipListName
);
oldTransfer
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
oldTransfer
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
oldTransfer
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
//启动流程
WorkflowResultDto
workflowResult
=
this
.
startWorkFlork
();
this
.
updateExecuteIds
(
instanceId
,
oldTransfer
,
"startWorkfow"
,
workflowResult
);
//生成代办
this
.
createToDoTask
(
Arrays
.
asList
(
workflowResult
),
oldTransfer
,
reginParams
.
getUserModel
().
getUserName
());
}
if
(!
ObjectUtils
.
isEmpty
(
instanceId
))
{
// 修改数据信息
this
.
updateExecuteIds
(
instanceId
,
oldTransfer
.
getSequenceNbr
(),
"0"
);
// 默认执行流程
String
status
=
oldTransfer
.
getStatus
();
String
operate
=
"0"
;
if
(
ValidationUtil
.
equals
(
status
,
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getRollBack
())
||
ValidationUtil
.
equals
(
status
,
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getReject
())){
operate
=
"提交"
;
}
this
.
flowExecute
(
oldTransfer
.
getSequenceNbr
(),
instanceId
,
operate
,
""
,
false
);
// this.updateExecuteIds(oldTransfer.getSequenceNbr(), "0");
this
.
flowExecute
(
oldTransfer
.
getSequenceNbr
(),
instanceId
,
"0"
,
""
,
false
);
}
}
return
true
;
...
...
@@ -338,26 +358,29 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param update
*/
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
boolean
update
)
{
WorkflowResultDto
workflowResult
=
new
WorkflowResultDto
();
JgChangeRegistrationTransfer
transfer
=
this
.
getById
(
id
);
try
{
JSONObject
task
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
JSONObject
taskMessage
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
task
.
get
(
"data"
)));
String
taskId
=
taskMessage
.
getString
(
"id"
);
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
t
askId
);
dto
.
setTaskId
(
t
ransfer
.
getNextTaskId
()
);
dto
.
setComment
(
comment
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
operate
);
dto
.
setVariable
(
map
);
if
(!
ObjectUtils
.
isEmpty
(
transfer
)
&&
(
transfer
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getRollBack
())
||
transfer
.
getStatus
().
equals
(
WorkFlowStatusEnum
.
TRANSFER_SUBMIT
.
getReject
())))
{
map
.
put
(
"approvalStatus"
,
"提交"
);
}
//执行流程
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
ProcessTaskDTO
complete
=
icmWorkflowService
.
complete
(
instanceId
,
dto
);
workflowResult
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
complete
)).
get
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// 更新下一步执行人
this
.
updateExecuteIds
(
instanceId
,
id
,
operate
);
this
.
updateExecuteIds
(
instanceId
,
transfer
,
operate
,
workflowResult
);
}
/**
...
...
@@ -367,40 +390,24 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*/
public
void
revocation
(
String
instanceId
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
taskCode
=
""
;
JgChangeRegistrationTransfer
jgTransfer
=
new
JgChangeRegistrationTransfer
();
LambdaQueryWrapper
<
JgChangeRegistrationTransfer
>
lambda
=
new
QueryWrapper
<
JgChangeRegistrationTransfer
>().
lambda
();
lambda
.
eq
(
JgChangeRegistrationTransfer:
:
getInstanceId
,
instanceId
);
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
try
{
workFlowFeginService
.
rollBack
(
instanceId
);
JSONObject
taskNoAuth
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
JSONObject
nextTask
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
taskNoAuth
.
get
(
"data"
)));
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
.
get
(
"data"
)))
{
String
nextTaskId
=
nextTask
.
getString
(
"id"
);
FeignClientResult
<
JSONObject
>
nodeInfo
=
workFlowFeginService
.
getNodeInfo
(
nextTaskId
);
JSONObject
result
=
nodeInfo
.
getResult
();
Map
<
String
,
Object
>
taskInfo
=
(
Map
<
String
,
Object
>)
result
.
get
(
"taskInfo"
);
taskCode
=
String
.
valueOf
(
taskInfo
.
get
(
"taskDefinitionKey"
));
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
JSONArray
data
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
<?,
?>)
datum
).
containsKey
(
"groupId"
))
{
roleList
.
add
(((
Map
<?,
?>)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
ProcessTaskDTO
processTask
=
icmWorkflowService
.
rollBack
(
instanceId
);
WorkflowResultDto
workflowResult
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTask
)).
get
(
0
);
String
taskCode
=
Optional
.
ofNullable
(
workflowResult
.
getNextTaskCode
()).
orElse
(
""
);
String
role
=
Optional
.
ofNullable
(
workflowResult
.
getNextExecutorRoleIds
()).
orElse
(
""
);
if
(!
ObjectUtils
.
isEmpty
(
taskCode
))
{
jgTransfer
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getRollBack
());
jgTransfer
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getRollBack
());
}
String
join
=
String
.
join
(
","
,
roleList
);
jgTransfer
.
setPromoter
(
""
);
jgTransfer
.
setNextExecutorIds
(
join
);
jgTransfer
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgTransfer
.
setNextExecutorIds
(
role
);
this
.
update
(
jgTransfer
,
lambda
);
//待办 撤回
commonService
.
rollbackTask
(
instanceId
);
}
...
...
@@ -537,7 +544,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
resultDataMap
.
put
(
"receiveOrgCode"
,
transferById
.
getReceiveOrgCode
()
+
"_"
+
transferById
.
getReceiveOrgName
());
}
//查询设备详情
if
(!
ValidationUtil
.
isEmpty
(
record
))
{
if
(!
ValidationUtil
.
isEmpty
(
record
))
{
Map
<
String
,
Object
>
equipDetailMap
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
record
);
resultDataMap
.
putAll
(
equipDetailMap
);
}
...
...
@@ -556,13 +563,13 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*/
public
Page
<
Map
<
String
,
Object
>>
queryListForPage
(
Page
<
Map
<
String
,
Object
>>
page
,
JgChangeRegistrationTransferDto
params
)
{
Page
<
Map
<
String
,
Object
>>
listPage
=
this
.
baseMapper
.
getListPage
(
page
,
params
,
params
.
getRoleIds
());
listPage
.
getRecords
().
stream
().
forEach
(
item
->
{
listPage
.
getRecords
().
stream
().
forEach
(
item
->
{
// 流程未走完时,移装地址需从 历史表中获取
if
(
item
.
containsKey
(
"status"
)
&&
!
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
item
.
get
(
"status"
).
toString
()))
{
String
fullAddress
=
""
;
if
(
item
.
containsKey
(
"equipId"
)
&&
item
.
containsKey
(
"applyNo"
))
{
if
(
item
.
containsKey
(
"equipId"
)
&&
item
.
containsKey
(
"applyNo"
))
{
JgRegistrationHistory
history
=
jgRegistrationHistoryService
.
getDteailByRecord
(
item
.
get
(
"equipId"
).
toString
(),
item
.
get
(
"applyNo"
).
toString
());
if
(!
ValidationUtil
.
isEmpty
(
history
))
{
if
(!
ValidationUtil
.
isEmpty
(
history
))
{
JSONObject
newPosition
=
JSON
.
parseObject
(
history
.
getChangeData
());
String
province
=
newPosition
.
getString
(
"province"
);
String
city
=
newPosition
.
getString
(
"city"
);
...
...
@@ -606,80 +613,91 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
return
listPage
;
}
//启动流程
public
String
startByVariable
()
{
String
instanceId
=
""
;
//启动流程
try
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
"submit"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
instanceId
;
}
public
void
updateExecuteIds
(
String
instanceId
,
Long
sequenceNbr
,
String
operate
)
{
public
void
updateExecuteIds
(
String
instanceId
,
JgChangeRegistrationTransfer
jgChangeRegistrationTransfer
,
String
operate
,
WorkflowResultDto
workflowResult
)
{
Boolean
updateTodoAndCreate
=
Boolean
.
TRUE
;
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
role
=
""
;
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
JgChangeRegistrationTransfer
jgChangeRegistrationTransfer
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
try
{
// 查询下节点任务
JSONObject
taskNoAuth
=
workFlowFeginService
.
getTaskNoAuth
(
instanceId
);
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
.
get
(
"data"
)))
{
JSONObject
nextTask
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
taskNoAuth
.
get
(
"data"
)));
String
nextTaskId
=
nextTask
.
getString
(
"id"
);
FeignClientResult
<
JSONObject
>
nodeInfo
=
workFlowFeginService
.
getNodeInfo
(
nextTaskId
);
JSONObject
result
=
nodeInfo
.
getResult
();
Map
<
String
,
Object
>
taskInfo
=
(
Map
<
String
,
Object
>)
result
.
get
(
"taskInfo"
);
taskCode
=
String
.
valueOf
(
taskInfo
.
get
(
"taskDefinitionKey"
));
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
JSONArray
data
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
)
datum
).
containsKey
(
"groupId"
))
{
roleList
.
add
(((
Map
)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(!
ObjectUtils
.
isEmpty
(
workflowResult
.
getNextTaskCode
()))
{
taskCode
=
Optional
.
ofNullable
(
workflowResult
.
getNextTaskCode
()).
orElse
(
""
);
}
String
role
=
Optional
.
ofNullable
(
workflowResult
.
getNextExecutorRoleIds
()).
orElse
(
""
);
if
(
operate
.
equals
(
"startWorkfow"
))
{
role
=
Optional
.
ofNullable
(
workflowResult
.
getExecutorRoleIds
()).
orElse
(
""
)
+
","
+
Optional
.
ofNullable
(
workflowResult
.
getNextExecutorRoleIds
()).
orElse
(
""
);
operate
=
"0"
;
instanceId
=
workflowResult
.
getInstanceId
();
updateTodoAndCreate
=
Boolean
.
FALSE
;
}
if
(!
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
taskCode
))
{
role
=
String
.
join
(
","
,
roleList
);
jgChangeRegistrationTransfer
.
setNextExecutorIds
(
role
);
jgChangeRegistrationTransfer
.
setInstanceId
(
instanceId
);
if
(!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationTransfer
.
getExecuteSequence
()))
{
jgChangeRegistrationTransfer
.
setExecuteSequence
(
jgChangeRegistrationTransfer
.
getExecuteSequence
()
+
","
+
role
);
jgChangeRegistrationTransfer
.
setNextTaskId
(
workflowResult
.
getNextTaskId
());
jgChangeRegistrationTransfer
.
setNextExecutorIds
(
role
);
if
(!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationTransfer
.
getInstanceStatus
()))
{
jgChangeRegistrationTransfer
.
setInstanceStatus
(
jgChangeRegistrationTransfer
.
getInstanceStatus
()
+
","
+
role
);
}
else
{
jgChangeRegistrationTransfer
.
set
ExecuteSequence
(
role
);
jgChangeRegistrationTransfer
.
set
InstanceStatus
(
role
);
}
jgChangeRegistrationTransfer
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
jgChangeRegistrationTransfer
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
// if (!ObjectUtils.isEmpty(jgChangeRegistrationTransfer.getExecuteSequence())) {
// jgChangeRegistrationTransfer.setExecuteSequence(jgChangeRegistrationTransfer.getExecuteSequence() + "," + role);
//
// } else {
// jgChangeRegistrationTransfer.setExecuteSequence(role);
// }
if
(
"0"
.
equals
(
operate
))
{
// 通过操作
jgChangeRegistrationTransfer
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgChangeRegistrationTransfer
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
jgChangeRegistrationTransfer
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getPass
());
}
else
{
// 驳回操作
jgChangeRegistrationTransfer
.
setAuditStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getReject
());
jgChangeRegistrationTransfer
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getReject
());
jgChangeRegistrationTransfer
.
setPromoter
(
""
);
}
if
(
updateTodoAndCreate
)
{
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
commonService
.
getDictionaryCodeByName
(
jgChangeRegistrationTransfer
.
getStatus
()));
map
.
put
(
"taskStatusLabel"
,
jgChangeRegistrationTransfer
.
getStatus
());
map
.
put
(
"relationId"
,
jgChangeRegistrationTransfer
.
getInstanceId
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setModel
(
jgChangeRegistrationTransfer
);
taskModelDto
.
setTaskName
(
workflowResult
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResult
.
getNextExecutorUserIds
());
taskModelDto
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setNextExecuteUser
(
workflowResult
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
else
{
jgChangeRegistrationTransfer
.
setAuditStatus
(
taskCode
);
jgChangeRegistrationTransfer
.
setStatus
(
taskCode
);
jgChangeRegistrationTransfer
.
setAuditPassDate
(
new
Date
());
jgChangeRegistrationTransfer
.
setAuditStatus
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
jgChangeRegistrationTransfer
.
setStatus
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
//流程执行完成后,更新设备使用信息
this
.
updateByFlowEnd
(
sequenceNbr
.
toString
(),
jgChangeRegistrationTransfer
.
getSupervisoryCode
());
this
.
updateByFlowEnd
(
jgChangeRegistrationTransfer
.
getSequenceNbr
().
toString
(),
jgChangeRegistrationTransfer
.
getSupervisoryCode
());
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
map
.
put
(
"relationId"
,
jgChangeRegistrationTransfer
.
getInstanceId
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
}
this
.
getBaseMapper
().
updateById
(
jgChangeRegistrationTransfer
);
}
/**
* 流程结束后需要更新的数据
*
...
...
@@ -861,22 +879,22 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
exportParamsMap
.
put
(
"isInvalid"
,
transferEq
.
getIsInvalid
());
JgRegistrationHistory
transferHistory
=
jgRegistrationHistoryService
.
getDteailByRecord
(
transferEq
.
getEquId
(),
transfer
.
getApplyNo
());
//登记机关
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getReceiveOrgName
()))
{
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getReceiveOrgName
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,登记机关为空!"
);
}
exportParamsMap
.
put
(
"receiveOrgName"
,
transfer
.
getReceiveOrgName
());
//使用登记证编号
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getUseRegistrationCode
()))
{
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getUseRegistrationCode
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,使用登记证编号为空!"
);
}
exportParamsMap
.
put
(
"useRegistrationCode"
,
transfer
.
getUseRegistrationCode
());
//使用单位名称
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getUseUnitName
()))
{
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getUseUnitName
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,使用单位名称为空!"
);
}
exportParamsMap
.
put
(
"useUnitName"
,
transfer
.
getUseUnitName
());
//监管码
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getSupervisoryCode
()))
{
if
(
ValidationUtil
.
isEmpty
(
transfer
.
getSupervisoryCode
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,监管码为空!"
);
}
exportParamsMap
.
put
(
"supervisoryCode"
,
transfer
.
getSupervisoryCode
());
...
...
@@ -886,8 +904,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
exportParamsMap
.
put
(
"giveOutMonth"
,
today
.
getMonthValue
());
exportParamsMap
.
put
(
"giveOutDay"
,
today
.
getDayOfMonth
());
//设备使用地址
if
(!
ValidationUtil
.
isEmpty
(
transferHistory
))
{
String
fullAddress
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
transferHistory
))
{
String
fullAddress
=
""
;
JSONObject
newPosition
=
JSON
.
parseObject
(
transferHistory
.
getChangeData
());
String
province
=
newPosition
.
getString
(
"province"
);
String
city
=
newPosition
.
getString
(
"city"
);
...
...
@@ -923,7 +941,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if
(!
ObjectUtils
.
isEmpty
(
address
))
{
fullAddress
+=
address
;
}
if
(
ValidationUtil
.
isEmpty
(
fullAddress
))
{
if
(
ValidationUtil
.
isEmpty
(
fullAddress
))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备使用地址为空!"
);
}
exportParamsMap
.
put
(
"fullAddress"
,
fullAddress
);
...
...
@@ -931,34 +949,34 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//查询设备注册信息
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoService
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
transferEq
.
getEquId
()));
if
(!
ValidationUtil
.
isEmpty
(
registerInfo
))
{
if
(!
ValidationUtil
.
isEmpty
(
registerInfo
))
{
//设备种类、类别、品种
String
equList
=
registerInfo
.
getEquList
();
//设备种类
String
equCategory
=
registerInfo
.
getEquCategory
();
//设备类别
String
equDefine
=
registerInfo
.
getEquDefine
();
//设备品种
List
<
EquipmentCategory
>
categoryList0
=
c
ommonService
.
getEquipmentCategoryList
(
equList
,
null
);
List
<
EquipmentCategory
>
categoryList1
=
c
ommonService
.
getEquipmentCategoryList
(
equCategory
,
null
);
List
<
EquipmentCategory
>
categoryList2
=
c
ommonService
.
getEquipmentCategoryList
(
equDefine
,
null
);
List
<
EquipmentCategory
>
categoryList0
=
iC
ommonService
.
getEquipmentCategoryList
(
equList
,
null
);
List
<
EquipmentCategory
>
categoryList1
=
iC
ommonService
.
getEquipmentCategoryList
(
equCategory
,
null
);
List
<
EquipmentCategory
>
categoryList2
=
iC
ommonService
.
getEquipmentCategoryList
(
equDefine
,
null
);
if
(
CollectionUtils
.
isNotEmpty
(
categoryList0
))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList0
.
get
(
0
).
getName
()))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList0
.
get
(
0
).
getName
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备种类为空!"
);
}
exportParamsMap
.
put
(
"equList"
,
categoryList0
.
get
(
0
).
getName
());
}
if
(
CollectionUtils
.
isNotEmpty
(
categoryList1
))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList1
.
get
(
0
).
getName
()))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList1
.
get
(
0
).
getName
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备类别为空!"
);
}
exportParamsMap
.
put
(
"equCategory"
,
categoryList1
.
get
(
0
).
getName
());
}
if
(
CollectionUtils
.
isNotEmpty
(
categoryList2
))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList2
.
get
(
0
).
getName
()))
{
if
(
ValidationUtil
.
isEmpty
(
categoryList2
.
get
(
0
).
getName
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备品种为空!"
);
}
exportParamsMap
.
put
(
"equDefine"
,
categoryList2
.
get
(
0
).
getName
());
}
//设备代码
if
(
ValidationUtil
.
isEmpty
(
registerInfo
.
getEquCode
()))
{
if
(
ValidationUtil
.
isEmpty
(
registerInfo
.
getEquCode
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备代码为空!"
);
}
exportParamsMap
.
put
(
"equCode"
,
registerInfo
.
getEquCode
());
...
...
@@ -966,21 +984,106 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//单位内部编码
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
transferEq
.
getEquId
());
if
(!
ValidationUtil
.
isEmpty
(
useInfo
))
{
if
(
ValidationUtil
.
isEmpty
(
useInfo
.
getUseInnerCode
()))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfo
))
{
if
(
ValidationUtil
.
isEmpty
(
useInfo
.
getUseInnerCode
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,设备单位内部编码为空!"
);
}
exportParamsMap
.
put
(
"useInnerCode"
,
useInfo
.
getUseInnerCode
());
}
IdxBizJgFactoryInfo
factoryInfo
=
idxBizJgFactoryInfoService
.
getOneData
(
transferEq
.
getEquId
());
//产品编号(出厂编号)
if
(!
ValidationUtil
.
isEmpty
(
factoryInfo
))
{
if
(
ValidationUtil
.
isEmpty
(
factoryInfo
.
getFactoryNum
()))
{
if
(!
ValidationUtil
.
isEmpty
(
factoryInfo
))
{
if
(
ValidationUtil
.
isEmpty
(
factoryInfo
.
getFactoryNum
()))
{
throw
new
BadRequest
(
"使用登记证导出失败,产品编号为空!"
);
}
exportParamsMap
.
put
(
"factoryNum"
,
factoryInfo
.
getFactoryNum
());
}
//调用生成使用登记证
commonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
iCommonService
.
generateCertificateReport
(
exportParamsMap
,
response
);
}
/**
* 启动工作流
*/
private
WorkflowResultDto
startWorkFlork
()
{
try
{
ActWorkflowBatchDTO
workflowBatchParams
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
workflowList
=
new
ArrayList
<>();
ActWorkflowStartDTO
workflow
=
new
ActWorkflowStartDTO
();
workflow
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
workflow
.
setBusinessKey
(
"submit"
);
workflow
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
workflowList
.
add
(
workflow
);
workflowBatchParams
.
setProcess
(
workflowList
);
List
<
ProcessTaskDTO
>
processTasks
=
icmWorkflowService
.
startBatch
(
workflowBatchParams
);
// 组装工作流返回的数据
return
commonService
.
buildWorkFlowInfo
(
processTasks
).
get
(
0
);
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
throw
new
BadRequest
(
"提交失败"
+
e
.
getMessage
());
}
}
/**
* 新增代办任务
*/
private
void
createToDoTask
(
List
<
WorkflowResultDto
>
sorkflows
,
JgChangeRegistrationTransfer
transfer
,
String
userName
)
{
if
(!
ValidationUtil
.
isEmpty
(
sorkflows
))
{
List
<
TaskModelDto
>
toDoTasklist
=
new
ArrayList
<>();
for
(
WorkflowResultDto
sorkflow
:
sorkflows
)
{
TaskModelDto
toDoTask
=
new
TaskModelDto
();
toDoTask
.
setTaskName
(
sorkflow
.
getTaskName
());
toDoTask
.
setFlowCreateDate
(
transfer
.
getCreateDate
());
toDoTask
.
setTaskCode
(
transfer
.
getApplyNo
());
toDoTask
.
setTaskContent
(
this
.
getSummaryInfo
(
transfer
));
// toDoTask.setTaskDesc();
toDoTask
.
setTaskType
(
BusinessTypeEnum
.
JG_CHANGE_REGISTRATION
.
getCode
());
toDoTask
.
setTaskTypeLabel
(
BusinessTypeEnum
.
JG_CHANGE_REGISTRATION
.
getName
());
toDoTask
.
setRelationId
(
transfer
.
getInstanceId
());
toDoTask
.
setExecuteUserIds
(
sorkflow
.
getNextExecutorUserIds
());
toDoTask
.
setTaskStatus
(
commonService
.
getDictionaryCodeByName
(
transfer
.
getStatus
()));
toDoTask
.
setTaskStatusLabel
(
transfer
.
getStatus
());
String
url
=
this
.
getUrl
(
JG_CHANGE_REGISTRATION
.
getCode
(),
"look"
);
String
format
=
String
.
format
(
url
,
transfer
.
getSequenceNbr
(),
transfer
.
getNextExecutorIds
(),
transfer
.
getNextExecutorIds
(),
transfer
.
getAuditStatus
(),
transfer
.
getInstanceId
());
toDoTask
.
setRoutePath
(
format
);
toDoTask
.
setModel
(
transfer
);
toDoTask
.
setStartUserId
(
transfer
.
getCreateUserId
());
toDoTask
.
setStartUser
(
transfer
.
getCreateUserName
());
toDoTask
.
setStartUserCompanyName
(
transfer
.
getCreateUserCompanyName
());
toDoTask
.
setStartDate
(
new
Date
());
toDoTasklist
.
add
(
toDoTask
);
}
commonService
.
buildTaskModel
(
toDoTasklist
);
}
}
//获取流程跳转页面的url
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
;
}
/**
* @return String
* @deprecated 动态获取
*/
public
String
getSummaryInfo
(
JgChangeRegistrationTransfer
transfer
)
{
String
result
=
"来自%s【%s】的业务办理,【申请单号:%s】"
;
return
String
.
format
(
result
,
transfer
.
getEquipListName
(),
transfer
.
getSupervisoryCode
(),
transfer
.
getApplyNo
());
}
}
\ 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