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
99d83fb1
Commit
99d83fb1
authored
Jan 09, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.任务下发
parent
ee365a0f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
408 additions
and
243 deletions
+408
-243
FeignAuthRequestInterceptor.java
...os/boot/biz/common/feign/FeignAuthRequestInterceptor.java
+6
-0
JgInstallationNotice.java
.../amos/boot/module/jg/api/entity/JgInstallationNotice.java
+5
-0
PublicWorkFlowMessage.java
...os/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
+48
-34
InstallationNoticeMsgListener.java
.../module/jg/biz/message/InstallationNoticeMsgListener.java
+45
-0
WorkFlowMessageListener.java
...s/boot/module/jg/biz/message/WorkFlowMessageListener.java
+76
-0
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+228
-209
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/feign/FeignAuthRequestInterceptor.java
View file @
99d83fb1
...
...
@@ -5,6 +5,7 @@ import feign.RequestTemplate;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -39,6 +40,11 @@ public class FeignAuthRequestInterceptor implements RequestInterceptor {
template
.
header
(
"token"
,
authToken
);
template
.
header
(
"appKey"
,
appKey
);
template
.
header
(
"product"
,
product
);
}
else
{
template
.
header
(
"X-Access-Token"
,
RequestContext
.
getToken
());
template
.
header
(
"token"
,
RequestContext
.
getToken
());
template
.
header
(
"appKey"
,
RequestContext
.
getAppKey
());
template
.
header
(
"product"
,
RequestContext
.
getProduct
());
}
}
}
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 @
99d83fb1
...
...
@@ -395,4 +395,9 @@ public class JgInstallationNotice extends BaseEntity {
@JsonSerialize
(
using
=
BizCustomDateSerializer
.
class
)
private
Date
handleDate
;
/**
* 流程任务状态(来源工作流)
*/
private
String
approvalStatus
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
listener
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.
service.impl.JgInstallationNoticeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.
message.WorkFlowMessageListener
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,60 +26,79 @@ public class PublicWorkFlowMessage extends EmqxListener {
@Autowired
AmosRequestContext
amosAuth
;
private
List
<
WorkFlowMessageListener
>
workFlowMessageListeners
;
public
PublicWorkFlowMessage
(
List
<
WorkFlowMessageListener
>
workFlowMessageListeners
)
{
this
.
workFlowMessageListeners
=
workFlowMessageListeners
;
}
/**
* 创建任务主题
*/
p
ublic
static
final
String
WORKFLOW_TASK_CREATED
=
"workflow/task/created"
;
p
rivate
static
final
String
WORKFLOW_TASK_CREATED
=
"workflow/task/created"
;
/**
* 执行完成任务主题
*/
p
ublic
static
final
String
WORKFLOW_TASK_COMPLETED
=
"workflow/task/completed"
;
p
rivate
static
final
String
WORKFLOW_TASK_COMPLETED
=
"workflow/task/completed"
;
/**
* 流程执行结束主题
*/
p
ublic
static
final
String
WORKFLOW_PROCESS_COMPLETE
=
"workflow/process/complete"
;
p
rivate
static
final
String
WORKFLOW_PROCESS_COMPLETE
=
"workflow/process/complete"
;
@Autowired
private
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Autowired
AmosRequestContext
amosRequestContext
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
WORKFLOW_TASK_CREATED
,
2
,
this
);
emqKeeper
.
subscript
(
WORKFLOW_TASK_COMPLETED
,
2
,
this
);
//
emqKeeper.subscript(WORKFLOW_PROCESS_COMPLETE, 2, this);
emqKeeper
.
subscript
(
WORKFLOW_PROCESS_COMPLETE
,
2
,
this
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
// RequestContext.setAppKey(amosAuth.getAppKey());
// RequestContext.setProduct(amosAuth.getProduct());
// RequestContext.setToken(amosAuth.getToken());
// RequestContext.setAgencyCode(amosAuth.getUserId());
// platformTokenService.getToken();
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
JSONObject
messageObject
=
JSON
.
parseObject
(
new
String
(
message
.
getPayload
()));
String
businessKey
=
messageObject
.
get
(
"businessKey"
).
toString
();
String
[]
s
=
businessKey
.
split
(
"_"
);
String
businessId
=
s
[
0
];
String
type
=
s
[
1
];
messageObject
.
put
(
"businessId"
,
businessId
);
if
(
topic
.
equals
(
WORKFLOW_TASK_CREATED
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
jgInstallationNoticeService
.
updateByWorkFlow
(
messageObject
);
}
}
else
if
(
topic
.
equals
(
WORKFLOW_TASK_COMPLETED
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
jgInstallationNoticeService
.
completeWorkFlow
(
messageObject
);
}
}
else
if
(
topic
.
equals
(
WORKFLOW_PROCESS_COMPLETE
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
// jgInstallationNoticeService.completeWorkFlow(messageObject);
log
.
info
(
"收到工作流消息,主题:{},内容:{}"
,
topic
,
messageObject
);
String
processDefinitionKey
=
messageObject
.
get
(
"processDefinitionKey"
).
toString
();
String
type
=
getApprovalStatusStr
(
messageObject
);
WorkFlowMessageListener
.
BizTypeEnum
bizTypeEnum
=
WorkFlowMessageListener
.
getEnum
(
processDefinitionKey
);
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
workFlowMessageListeners
.
forEach
(
h
->
{
if
(
h
.
canHandlerType
().
equals
(
bizTypeEnum
))
{
switch
(
topic
)
{
case
WORKFLOW_TASK_CREATED:
h
.
afterCreate
(
messageObject
);
break
;
case
WORKFLOW_TASK_COMPLETED:
h
.
afterComplete
(
type
,
messageObject
);
break
;
case
WORKFLOW_PROCESS_COMPLETE:
h
.
afterFinish
(
messageObject
);
break
;
default
:
break
;
}
}
});
}
private
String
getApprovalStatusStr
(
JSONObject
messageObject
)
{
String
type
=
""
;
JSONObject
variables
=
messageObject
.
getJSONObject
(
"variables"
);
if
(
variables
!=
null
)
{
type
=
variables
.
getString
(
"approvalStatus"
);
}
return
type
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/message/InstallationNoticeMsgListener.java
0 → 100644
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
message
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* @author Administrator
*/
@Component
public
class
InstallationNoticeMsgListener
implements
WorkFlowMessageListener
{
@Autowired
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
/**
* 处理消息方法-Create
* 1.更新业务数据【instanceId、nextExecutedIds、status、instanceStatus(所有执行过的加下一步待执行角色)】
* 2.创建待办(初始未完成状态)
* @param message message 消息内容
*/
@Override
public
void
afterCreate
(
JSONObject
message
)
{
jgInstallationNoticeService
.
updateByWorkFlow
(
message
);
}
@Override
public
void
afterComplete
(
String
type
,
JSONObject
message
)
{
jgInstallationNoticeService
.
completeWorkFlow
(
type
,
message
);
}
@Override
public
void
afterFinish
(
JSONObject
message
)
{
String
businessKey
=
message
.
getString
(
"businessKey"
);
JgInstallationNotice
jgInstallationNotice
=
jgInstallationNoticeService
.
getBaseMapper
().
selectById
(
businessKey
);
jgInstallationNoticeService
.
finishTask
(
jgInstallationNotice
);
}
@Override
public
BizTypeEnum
canHandlerType
()
{
return
BizTypeEnum
.
installationNotificationNew
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/message/WorkFlowMessageListener.java
0 → 100644
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
message
;
import
com.alibaba.fastjson.JSONObject
;
/**
* @author Administrator
*/
public
interface
WorkFlowMessageListener
{
/**
* 处理消息方法-Create
* 1.更新业务数据【instanceId、nextExecutedIds、status、instanceStatus(所有执行过的加下一步待执行角色)】
* 2.创建待办(初始未完成状态)
* @param message message 消息内容
*/
void
afterCreate
(
JSONObject
message
);
/**
* 处理消息方法-完成
* 1.更新代办(更新为已完成状态)
* 2.更新业务数据【status、instanceStatus(所有执行过的加下一步待执行角色)、新增字段-taskResult(工作流节点执行结果)】
* @param approvalStatus 工作流任务状态
* @param message message 消息内容
*/
void
afterComplete
(
String
approvalStatus
,
JSONObject
message
);
/**
* 处理消息方法-流程结束
* 1.业务处理
* @param message message 消息内容
*/
void
afterFinish
(
JSONObject
message
);
/**
* 可处理的消息类型
* @return BizTypeEnum
*/
BizTypeEnum
canHandlerType
();
enum
BizTypeEnum
{
// 更名变更登记
unitRename
,
// 单位变更
unitChange
,
// 移装变更登记
changeRegistrationTransfer
,
// 使用登记审核
useRegistration
,
// 安装告知
installationNotificationNew
,
// 维保备案
maintenanceFiling
,
// 电梯注销
scrapCancel
,
// 改造变更登记
renovationRegistrationReview
,
// 维修告知
maintainNotice
,
// 改造告知
renovationNoticeNew
,
// 电梯停用启用
deactivateEnable
,
// 移装告知
transferNotice
,
// 设备移交
equipmentHandover
}
static
BizTypeEnum
getEnum
(
String
name
){
return
BizTypeEnum
.
valueOf
(
name
);
}
}
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 @
99d83fb1
...
...
@@ -29,6 +29,7 @@ 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.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
...
...
@@ -137,6 +138,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
private
PlatformTransactionManager
platformTransactionManager
;
@Autowired
AmosRequestContext
amosRequestContext
;
/**
* 根据sequenceNbr查询
*
...
...
@@ -246,7 +250,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
updateTaskModel
(
map
);
updateTaskModel
(
map
,
null
);
}
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
...
...
@@ -468,9 +472,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setPromoter
(
reginParams
.
getUserModel
().
get
UserId
());
dto
.
setPromoter
(
RequestContext
.
getExe
UserId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
dto
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
dto
.
setEquList
((
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
))));
...
...
@@ -506,11 +511,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 发起流程
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
item
.
getSequenceNbr
()
+
"
_"
+
"installationNotice
"
);
dto
.
setBusinessKey
(
item
.
getSequenceNbr
()
+
""
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
HashMap
<
String
,
Object
>
variables
=
new
HashMap
<>();
variables
.
put
(
"code"
,
"2121"
);
dto
.
setVariables
(
variables
);
workflowStartDTOS
.
add
(
dto
);
}
});
...
...
@@ -714,12 +716,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
if
(
ajaxResult
.
getStatus
()
==
200
)
{
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
);
//
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
]);
...
...
@@ -736,164 +738,141 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
String
userId
=
RequestContext
.
getExeUserId
();
JgInstallationNotice
jgInstallationNotice
=
this
.
jgInstallationNoticeMapper
.
selectById
(
dto
.
getSequenceNbr
());
jgInstallationNotice
.
setProcessAdvice
(
dto
.
getProcessAdvice
());
// 组装设备注册代码
StringBuffer
stringBuffer
=
new
StringBuffer
();
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
boolean
submit
=
submit
(
jgInstallationNotice
,
op
);
// 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
;
try
{
ym
=
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
DATE_PATTERN_MM
);
}
catch
(
ParseException
e
)
{
log
.
error
(
"日期转换失败:{}"
,
e
);
}
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
boolean
submit
=
submit
(
jgInstallationNotice
,
op
);
if
(
submit
)
{
// getNext(roleList, dto.getInstanceId(),taskName);
// jgInstallationNotice.setStatus(taskName[0]);
if
(
"0"
.
equals
(
op
))
{
if
(
roleList
.
size
()
==
0
)
{
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
dto
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
OtherInfo
tzsJgOtherInfo
=
tzsJgOtherInfoMapper
.
selectOne
(
queryWrapper1
);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgInstallationNotice
.
getCity
()).
append
(
ym
);
String
equCode
=
stringBuffer
.
toString
();
ResponseModel
<
String
>
responseModel
=
tzsServiceFeignClient
.
deviceRegistrationCode
(
equCode
);
String
deviceRegistrationCode
=
responseModel
.
getResult
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cityCode"
,
jgInstallationNotice
.
getCity
());
map
.
put
(
"countyCode"
,
jgInstallationNotice
.
getCounty
());
map
.
put
(
"equCategory"
,
tzsJgRegistrationInfo
.
getEquCategory
());
map
.
put
(
"isXiXian"
,
jgInstallationNotice
.
getIsXixian
()
==
null
?
"null"
:
jgInstallationNotice
.
getIsXixian
().
equals
(
"0"
)
?
"null"
:
"1"
);
Map
<
String
,
Object
>
mapCode
;
ResponseModel
<
Map
<
String
,
Object
>>
code
=
tzsServiceFeignClient
.
createCode
(
map
);
mapCode
=
code
.
getResult
();
LambdaQueryWrapper
<
SupervisoryCodeInfo
>
queryWrapper3
=
new
LambdaQueryWrapper
<>();
queryWrapper3
.
eq
(
SupervisoryCodeInfo:
:
getSupervisoryCode
,
mapCode
.
get
(
"superviseCode"
).
toString
());
SupervisoryCodeInfo
supervisoryCodeInfo
=
supervisoryCodeInfoMapper
.
selectOne
(
queryWrapper3
);
supervisoryCodeInfo
.
setStatus
(
"1"
);
supervisoryCodeInfoMapper
.
updateById
(
supervisoryCodeInfo
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
jgInstallationNotice
.
setHandleDate
(
new
Date
());
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
// 更新其他业务表
if
(!
ValidationUtil
.
isEmpty
(
mapCode
.
get
(
"code96333"
)))
{
tzsJgOtherInfo
.
setCode96333
(
mapCode
.
get
(
"code96333"
).
toString
());
map1
.
put
(
"CODE96333"
,
tzsJgOtherInfo
.
getCode96333
()
);
}
tzsJgOtherInfo
.
setSupervisoryCode
(
mapCode
.
get
(
"superviseCode"
).
toString
());
tzsJgRegistrationInfo
.
setEquCode
(
deviceRegistrationCode
);
jgInstallationNotice
.
setEquRegisterCode
(
deviceRegistrationCode
);
jgInstallationNotice
.
setSupervisoryCode
(
mapCode
.
get
(
"superviseCode"
).
toString
());
Map
<
String
,
Map
<
String
,
Object
>>
objMap
=
new
HashMap
<>();
map1
.
put
(
"EQU_CODE"
,
tzsJgRegistrationInfo
.
getEquCode
()
);
map1
.
put
(
"SUPERVISORY_CODE"
,
tzsJgOtherInfo
.
getSupervisoryCode
());
map1
.
put
(
"USE_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getUseUnitCreditCode
());
map1
.
put
(
"USE_UNIT_NAME"
,
jgInstallationNotice
.
getUseUnitName
());
map1
.
put
(
"USC_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
map1
.
put
(
"USC_UNIT_NAME"
,
jgInstallationNotice
.
getInstallUnitName
());
objMap
.
put
(
tzsJgOtherInfo
.
getRecord
(),
map1
);
jgInstallationNotice
.
setPromoter
(
""
);
tzsServiceFeignClient
.
commonUpdateEsDataByIds
(
objMap
);
tzsJgOtherInfoMapper
.
updateById
(
tzsJgOtherInfo
);
tzsJgRegistrationInfoMapper
.
updateById
(
tzsJgRegistrationInfo
);
// 更新施工信息表
IdxBizJgConstructionInfo
idxBizJgConstructionInfo
=
constructionInfoService
.
queryNewestDetailByRecord
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
idxBizJgConstructionInfo
))
{
idxBizJgConstructionInfo
.
setUscUnitCreditCode
(
jgInstallationNotice
.
getInstallUnitCreditCode
());
idxBizJgConstructionInfo
.
setUscUnitName
(
jgInstallationNotice
.
getInstallUnitName
());
idxBizJgConstructionInfo
.
setUscDate
(
jgInstallationNotice
.
getInstallStartDate
());
// 获取施工类型id
LambdaQueryWrapper
<
DataDictionary
>
lambda
=
new
LambdaQueryWrapper
<>();
lambda
.
eq
(
DataDictionary:
:
getType
,
CONSTRUCTION_TYPE
);
lambda
.
eq
(
DataDictionary:
:
getName
,
CONSTRUCTION_TYPE_NAME
);
List
<
DataDictionary
>
dataDictionaries
=
dataDictionaryMapper
.
selectList
(
lambda
);
if
(!
CollectionUtils
.
isEmpty
(
dataDictionaries
))
{
idxBizJgConstructionInfo
.
setConstructionType
(
String
.
valueOf
(
dataDictionaries
.
get
(
0
).
getSequenceNbr
()));
}
constructionInfoService
.
saveOrUpdateData
(
idxBizJgConstructionInfo
);
}
// 使用信息表更新是否西咸
IdxBizJgUseInfo
useInfo
=
useInfoService
.
getOneData
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
useInfo
))
{
useInfo
.
setUseUnitCreditCode
(
jgInstallationNotice
.
getUseUnitCreditCode
());
useInfo
.
setUseUnitName
(
jgInstallationNotice
.
getUseUnitName
());
useInfo
.
setIsNotXiXian
(
jgInstallationNotice
.
getIsXixian
()
==
null
?
"0"
:
jgInstallationNotice
.
getIsXixian
());
useInfoService
.
saveOrUpdateData
(
useInfo
);
}
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// generateInstallationNoticeReport(jgInstallationNotice.getSequenceNbr());
// }
// });
}
else
{
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
if
(!
ObjectUtils
.
isEmpty
(
jgInstallationNotice
.
getInstanceStatus
()))
{
jgInstallationNotice
.
setInstanceStatus
(
jgInstallationNotice
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
roleList
));
}
else
{
jgInstallationNotice
.
setInstanceStatus
(
String
.
join
(
","
,
roleList
));
}
jgInstallationNotice
.
setPromoter
(
userId
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
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
());
updateTaskModel
(
map
);
}
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
);
// 组装设备注册代码
StringBuffer
stringBuffer
=
new
StringBuffer
();
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
OtherInfo
tzsJgOtherInfo
=
tzsJgOtherInfoMapper
.
selectOne
(
queryWrapper1
);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgInstallationNotice
.
getCity
()).
append
(
ym
);
String
equCode
=
stringBuffer
.
toString
();
ResponseModel
<
String
>
responseModel
=
tzsServiceFeignClient
.
deviceRegistrationCode
(
equCode
);
String
deviceRegistrationCode
=
responseModel
.
getResult
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cityCode"
,
jgInstallationNotice
.
getCity
());
map
.
put
(
"countyCode"
,
jgInstallationNotice
.
getCounty
());
map
.
put
(
"equCategory"
,
tzsJgRegistrationInfo
.
getEquCategory
());
map
.
put
(
"isXiXian"
,
jgInstallationNotice
.
getIsXixian
()
==
null
?
"null"
:
jgInstallationNotice
.
getIsXixian
().
equals
(
"0"
)
?
"null"
:
"1"
);
Map
<
String
,
Object
>
mapCode
;
ResponseModel
<
Map
<
String
,
Object
>>
code
=
tzsServiceFeignClient
.
createCode
(
map
);
mapCode
=
code
.
getResult
();
LambdaQueryWrapper
<
SupervisoryCodeInfo
>
queryWrapper3
=
new
LambdaQueryWrapper
<>();
queryWrapper3
.
eq
(
SupervisoryCodeInfo:
:
getSupervisoryCode
,
mapCode
.
get
(
"superviseCode"
).
toString
());
SupervisoryCodeInfo
supervisoryCodeInfo
=
supervisoryCodeInfoMapper
.
selectOne
(
queryWrapper3
);
supervisoryCodeInfo
.
setStatus
(
"1"
);
supervisoryCodeInfoMapper
.
updateById
(
supervisoryCodeInfo
);
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
jgInstallationNotice
.
setHandleDate
(
new
Date
());
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
// 更新其他业务表
if
(!
ValidationUtil
.
isEmpty
(
mapCode
.
get
(
"code96333"
)))
{
tzsJgOtherInfo
.
setCode96333
(
mapCode
.
get
(
"code96333"
).
toString
());
map1
.
put
(
"CODE96333"
,
tzsJgOtherInfo
.
getCode96333
()
);
}
tzsJgOtherInfo
.
setSupervisoryCode
(
mapCode
.
get
(
"superviseCode"
).
toString
());
tzsJgRegistrationInfo
.
setEquCode
(
deviceRegistrationCode
);
jgInstallationNotice
.
setEquRegisterCode
(
deviceRegistrationCode
);
jgInstallationNotice
.
setSupervisoryCode
(
mapCode
.
get
(
"superviseCode"
).
toString
());
Map
<
String
,
Map
<
String
,
Object
>>
objMap
=
new
HashMap
<>();
map1
.
put
(
"EQU_CODE"
,
tzsJgRegistrationInfo
.
getEquCode
()
);
map1
.
put
(
"SUPERVISORY_CODE"
,
tzsJgOtherInfo
.
getSupervisoryCode
());
map1
.
put
(
"USE_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getUseUnitCreditCode
());
map1
.
put
(
"USE_UNIT_NAME"
,
jgInstallationNotice
.
getUseUnitName
());
map1
.
put
(
"USC_UNIT_CREDIT_CODE"
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
map1
.
put
(
"USC_UNIT_NAME"
,
jgInstallationNotice
.
getInstallUnitName
());
objMap
.
put
(
tzsJgOtherInfo
.
getRecord
(),
map1
);
jgInstallationNotice
.
setPromoter
(
""
);
tzsServiceFeignClient
.
commonUpdateEsDataByIds
(
objMap
);
tzsJgOtherInfoMapper
.
updateById
(
tzsJgOtherInfo
);
tzsJgRegistrationInfoMapper
.
updateById
(
tzsJgRegistrationInfo
);
// 更新施工信息表
IdxBizJgConstructionInfo
idxBizJgConstructionInfo
=
constructionInfoService
.
queryNewestDetailByRecord
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
idxBizJgConstructionInfo
))
{
idxBizJgConstructionInfo
.
setUscUnitCreditCode
(
jgInstallationNotice
.
getInstallUnitCreditCode
());
idxBizJgConstructionInfo
.
setUscUnitName
(
jgInstallationNotice
.
getInstallUnitName
());
idxBizJgConstructionInfo
.
setUscDate
(
jgInstallationNotice
.
getInstallStartDate
());
// 获取施工类型id
LambdaQueryWrapper
<
DataDictionary
>
lambda
=
new
LambdaQueryWrapper
<>();
lambda
.
eq
(
DataDictionary:
:
getType
,
CONSTRUCTION_TYPE
);
lambda
.
eq
(
DataDictionary:
:
getName
,
CONSTRUCTION_TYPE_NAME
);
List
<
DataDictionary
>
dataDictionaries
=
dataDictionaryMapper
.
selectList
(
lambda
);
if
(!
CollectionUtils
.
isEmpty
(
dataDictionaries
))
{
idxBizJgConstructionInfo
.
setConstructionType
(
String
.
valueOf
(
dataDictionaries
.
get
(
0
).
getSequenceNbr
()));
}
jgInstallationNoticeMapper
.
updateById
(
jgInstallationNotice
);
constructionInfoService
.
saveOrUpdateData
(
idxBizJgConstructionInfo
);
}
// 使用信息表更新是否西咸
IdxBizJgUseInfo
useInfo
=
useInfoService
.
getOneData
(
jgRelationEquip
.
getEquId
());
if
(!
ObjectUtils
.
isEmpty
(
useInfo
))
{
useInfo
.
setUseUnitCreditCode
(
jgInstallationNotice
.
getUseUnitCreditCode
());
useInfo
.
setUseUnitName
(
jgInstallationNotice
.
getUseUnitName
());
useInfo
.
setIsNotXiXian
(
jgInstallationNotice
.
getIsXixian
()
==
null
?
"0"
:
jgInstallationNotice
.
getIsXixian
());
useInfoService
.
saveOrUpdateData
(
useInfo
);
}
}
...
...
@@ -905,25 +884,27 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
model
.
setCreateDate
(
new
Date
());
model
.
setFinishStatus
(
Boolean
.
FALSE
);
model
.
setAgencyCode
(
"tzs"
);
model
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
model
.
setStartUserId
(
RequestContext
.
getExeUserId
());
model
.
setTaskTitle
(
"发起了"
+
model
.
getTaskTitle
());
Systemctl
.
taskV2Client
.
create
(
model
);
}
public
TaskV2Model
updateTaskModel
(
Map
<
String
,
Object
>
params
){
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
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
().
sorted
((
r1
,
r2
)
->
r2
.
getCreateDate
().
compareTo
(
r1
.
getCreateDate
()))
// 按时间降序排序
.
findFirst
()
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
(
reginParams
.
getUserModel
().
getUserId
()
);
model
.
setEndUserId
(
userJson
!=
null
?
userJson
.
get
(
"userId"
).
toString
()
:
""
);
if
(
params
.
containsKey
(
"isDelete"
))
{
Systemctl
.
taskV2Client
.
delete
(
model
.
getSequenceNbr
().
toString
());
}
else
{
...
...
@@ -951,7 +932,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
public
void
updateByWorkFlow
(
JSONObject
jsonObject
)
{
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
jsonObject
.
get
(
"businessId"
).
toString
());
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
<>();
...
...
@@ -965,46 +947,82 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
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
);
// 代办业务
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
(
userIds
);
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
jgInstallationNotice
));
taskV2Model
.
setRelationId
(
jgInstallationNotice
.
getInstanceId
());
taskV2Model
.
setTaskType
(
"installNotice"
);
taskV2Model
.
setTaskTypeLabel
(
"安装告知"
);
String
url
=
getUrl
(
taskV2Model
.
getTaskType
(),
"look"
);
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
());
taskV2Model
.
setStartUserId
(
jgInstallationNotice
.
getCreateUserId
());
taskV2Model
.
setCreateUserId
(
jgInstallationNotice
.
getCreateUserId
());
buildTaskModel
(
taskV2Model
);
if
(!
"撤回"
.
equals
(
jgInstallationNotice
.
getApprovalStatus
()))
{
// 创建待办
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
taskV2Model
.
setExecuteUserIds
(
userIds
);
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
jgInstallationNotice
));
taskV2Model
.
setRelationId
(
jgInstallationNotice
.
getInstanceId
());
taskV2Model
.
setTaskType
(
"installNotice"
);
taskV2Model
.
setTaskTypeLabel
(
"安装告知"
);
String
url
=
getUrl
(
taskV2Model
.
getTaskType
(),
"look"
);
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
(
noticeStatus
.
getCode
());
taskV2Model
.
setTaskStatusLabel
(
noticeStatus
.
getName
());
taskV2Model
.
setTaskCode
(
jgInstallationNotice
.
getApplyNo
());
taskV2Model
.
setStartUserId
(
jgInstallationNotice
.
getCreateUserId
());
taskV2Model
.
setCreateUserId
(
jgInstallationNotice
.
getCreateUserId
());
buildTaskModel
(
taskV2Model
);
}
}
public
void
completeWorkFlow
(
JSONObject
jsonObject
)
{
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
jsonObject
.
get
(
"businessId"
).
toString
());
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
{
return
FlowStatusEnum
.
ROLLBACK
;
}
}
List
<
TaskV2Model
>
result
=
Systemctl
.
taskV2Client
.
selectListByRelationId
(
jgInstallationNotice
.
getInstanceId
()).
getResult
();
TaskV2Model
model
=
result
.
stream
().
sorted
((
r1
,
r2
)
->
r2
.
getCreateDate
().
compareTo
(
r1
.
getCreateDate
()))
// 按时间降序排序
.
findFirst
()
.
orElse
(
null
);
// model.setTaskStatus(Integer.valueOf(jsonObject.get("nodeName").toString()));
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
());
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
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