Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -53,25 +53,25 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
private IDictDataService dictDataService;
|
private IDictDataService dictDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pushDoneRiskHazardWorkflow(Long id,String todoType) {
|
public boolean pushDoneRiskHazardWorkflow(Long id, String todoType) {
|
||||||
// 0.1.查找风险隐患数据,如果查不到则放弃推送
|
// 0.1.查找风险隐患数据,如果查不到则放弃推送
|
||||||
Map<String, Object> risk = riskService.getRiskById(id);
|
Map<String, Object> risk = riskService.getRiskById(id);
|
||||||
if (MapUtil.isEmpty(risk)) return false;
|
if (MapUtil.isEmpty(risk)) return false;
|
||||||
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (ObjectUtil.isNull(portalRequest)) return false;
|
if (!Objects.requireNonNull(portalRequest).available()) return false;
|
||||||
|
|
||||||
// 1.构建请求参数,准备推送待办信息
|
// 1.构建请求参数,准备推送待办信息
|
||||||
String creator="";
|
String creator = "";
|
||||||
String receiver="";
|
String receiver = "";
|
||||||
String isRemark="";
|
String isRemark = "";
|
||||||
String viewType="";
|
String viewType = "";
|
||||||
String checkArea="";
|
String checkArea = "";
|
||||||
// 1.1.拼接标题
|
// 1.1.拼接标题
|
||||||
|
|
||||||
DictDataDO dictData = dictDataService.getDictData("check_area_dic", risk.getOrDefault("check_area", "").toString());
|
DictDataDO dictData = dictDataService.getDictData("check_area_dic", risk.getOrDefault("check_area", "").toString());
|
||||||
if (dictData != null) {
|
if (dictData != null) {
|
||||||
checkArea=dictData.getLabel();
|
checkArea = dictData.getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
String requestName = DateUtil.formatDate((Date) risk.getOrDefault("check_date", new Date())) + SPACE +
|
String requestName = DateUtil.formatDate((Date) risk.getOrDefault("check_date", new Date())) + SPACE +
|
||||||
@@ -81,15 +81,13 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
risk.getOrDefault("check_problem", "") + SPACE +
|
risk.getOrDefault("check_problem", "") + SPACE +
|
||||||
risk.getOrDefault("check_people", "");
|
risk.getOrDefault("check_people", "");
|
||||||
// 1.2.根据代办类型取消息发送者 TODO 需要升级存储检查人的username
|
// 1.2.根据代办类型取消息发送者 TODO 需要升级存储检查人的username
|
||||||
if(todoType.equals("CHARGE_TODO")||todoType.equals("CHARGE_DONE")){
|
if (todoType.equals("CHARGE_TODO") || todoType.equals("CHARGE_DONE")) {
|
||||||
if(todoType.equals("CHARGE_TODO"))
|
if (todoType.equals("CHARGE_TODO")) {
|
||||||
{
|
isRemark = WORK_STATUS_TODO;
|
||||||
isRemark=WORK_STATUS_TODO;
|
viewType = VIEW_TYPE_UNREAD;
|
||||||
viewType=VIEW_TYPE_UNREAD;
|
} else {
|
||||||
}else
|
isRemark = WORK_STATUS_DONE;
|
||||||
{
|
viewType = VIEW_TYPE_READ;
|
||||||
isRemark=WORK_STATUS_DONE;
|
|
||||||
viewType=VIEW_TYPE_READ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 消息发送者为 检查人
|
// 消息发送者为 检查人
|
||||||
@@ -97,49 +95,40 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
AdminUserRespDTO createUser = Optional.ofNullable(createUserId)
|
AdminUserRespDTO createUser = Optional.ofNullable(createUserId)
|
||||||
.map(userId -> apiAdminUserApi.getUser(userId))
|
.map(userId -> apiAdminUserApi.getUser(userId))
|
||||||
.orElse(new AdminUserRespDTO());
|
.orElse(new AdminUserRespDTO());
|
||||||
if(StringUtils.isEmpty(createUser.getUsername()))
|
if (StringUtils.isEmpty(createUser.getUsername())) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}else
|
} else {
|
||||||
{
|
creator = createUser.getUsername();
|
||||||
creator=createUser.getUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 消息接受者为 整改责任人
|
// 消息接受者为 整改责任人
|
||||||
Long receiveId = Objects.isNull(risk.get("corrective_charge_people_id")) ? null : Long.valueOf( risk.get("corrective_charge_people_id").toString());
|
Long receiveId = Objects.isNull(risk.get("corrective_charge_people_id")) ? null : Long.valueOf(risk.get("corrective_charge_people_id").toString());
|
||||||
AdminUserRespDTO receiveUser = Optional.ofNullable(receiveId)
|
AdminUserRespDTO receiveUser = Optional.ofNullable(receiveId)
|
||||||
.map(userId -> apiAdminUserApi.getUser(userId))
|
.map(userId -> apiAdminUserApi.getUser(userId))
|
||||||
.orElse(new AdminUserRespDTO());
|
.orElse(new AdminUserRespDTO());
|
||||||
if(StringUtils.isEmpty(receiveUser.getUsername()))
|
if (StringUtils.isEmpty(receiveUser.getUsername())) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}else
|
} else {
|
||||||
{
|
receiver = receiveUser.getUsername();
|
||||||
receiver=receiveUser.getUsername();
|
|
||||||
}
|
}
|
||||||
}else if(todoType.equals("CONFIRM_TODO")||todoType.equals("CONFIRM_DONE"))
|
} else if (todoType.equals("CONFIRM_TODO") || todoType.equals("CONFIRM_DONE")) {
|
||||||
{
|
if (todoType.equals("CONFIRM_TODO")) {
|
||||||
if(todoType.equals("CONFIRM_TODO"))
|
isRemark = WORK_STATUS_TODO;
|
||||||
{
|
viewType = VIEW_TYPE_UNREAD;
|
||||||
isRemark=WORK_STATUS_TODO;
|
} else {
|
||||||
viewType=VIEW_TYPE_UNREAD;
|
isRemark = WORK_STATUS_DONE;
|
||||||
}else
|
viewType = VIEW_TYPE_READ;
|
||||||
{
|
|
||||||
isRemark=WORK_STATUS_DONE;
|
|
||||||
viewType=VIEW_TYPE_READ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 消息发送者为 整改责任人
|
// 消息发送者为 整改责任人
|
||||||
Long createUserId = Objects.isNull(risk.get("corrective_charge_people_id")) ? null : Long.valueOf( risk.get("corrective_charge_people_id").toString());
|
Long createUserId = Objects.isNull(risk.get("corrective_charge_people_id")) ? null : Long.valueOf(risk.get("corrective_charge_people_id").toString());
|
||||||
AdminUserRespDTO createUser = Optional.ofNullable(createUserId)
|
AdminUserRespDTO createUser = Optional.ofNullable(createUserId)
|
||||||
.map(userId -> apiAdminUserApi.getUser(userId))
|
.map(userId -> apiAdminUserApi.getUser(userId))
|
||||||
.orElse(new AdminUserRespDTO());
|
.orElse(new AdminUserRespDTO());
|
||||||
if(StringUtils.isEmpty(createUser.getUsername()))
|
if (StringUtils.isEmpty(createUser.getUsername())) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}else
|
} else {
|
||||||
{
|
creator = createUser.getUsername();
|
||||||
creator=createUser.getUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 消息接受者为 整改确认人
|
// 消息接受者为 整改确认人
|
||||||
@@ -147,12 +136,10 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
AdminUserRespDTO receiveUser = Optional.ofNullable(receiveId)
|
AdminUserRespDTO receiveUser = Optional.ofNullable(receiveId)
|
||||||
.map(userId -> apiAdminUserApi.getUser(userId))
|
.map(userId -> apiAdminUserApi.getUser(userId))
|
||||||
.orElse(new AdminUserRespDTO());
|
.orElse(new AdminUserRespDTO());
|
||||||
if(StringUtils.isEmpty(receiveUser.getUsername()))
|
if (StringUtils.isEmpty(receiveUser.getUsername())) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}else
|
} else {
|
||||||
{
|
receiver = receiveUser.getUsername();
|
||||||
receiver=receiveUser.getUsername();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 1.2.组织请求数据
|
// 1.2.组织请求数据
|
||||||
@@ -175,8 +162,7 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
// 2.推送待办信息,使用try-catch避免影响上层调用方法的事务回滚
|
// 2.推送待办信息,使用try-catch避免影响上层调用方法的事务回滚
|
||||||
try {
|
try {
|
||||||
portalRequest.receiveRequestInfo(todoRequestDTO);
|
portalRequest.receiveRequestInfo(todoRequestDTO);
|
||||||
if(todoType.equals("CONFIRM_DONE"))
|
if (todoType.equals("CONFIRM_DONE")) {
|
||||||
{
|
|
||||||
portalRequest.receiveRequestInfo(completeRequestDTO);
|
portalRequest.receiveRequestInfo(completeRequestDTO);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -193,7 +179,7 @@ public class PortalTodoServiceImpl implements IPortalTodoService {
|
|||||||
if (MapUtil.isEmpty(risk)) return false;
|
if (MapUtil.isEmpty(risk)) return false;
|
||||||
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (ObjectUtil.isNull(portalRequest)) return false;
|
if (!Objects.requireNonNull(portalRequest).available()) return false;
|
||||||
|
|
||||||
// 1.构建请求参数,准备推送待办信息
|
// 1.构建请求参数,准备推送待办信息
|
||||||
DeleteRequestInfoDTO deleteRequestInfoDTO = new DeleteRequestInfoDTO()
|
DeleteRequestInfoDTO deleteRequestInfoDTO = new DeleteRequestInfoDTO()
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class RiskServiceImpl implements IRiskService {
|
|||||||
|
|
||||||
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
// 0.2.从容器中获取 PortalRequest 对象,如果没有配置则放弃通知
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (ObjectUtil.isNull(portalRequest)) return;
|
if (!Objects.requireNonNull(portalRequest).available()) return;
|
||||||
|
|
||||||
// 1.构建请求参数,准备推送待办信息
|
// 1.构建请求参数,准备推送待办信息
|
||||||
// 1.1.拼接标题
|
// 1.1.拼接标题
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
|||||||
protected void processCancelled(FlowableCancelledEvent event) {
|
protected void processCancelled(FlowableCancelledEvent event) {
|
||||||
// 流程取消事件,这里对应调用流程删除接口
|
// 流程取消事件,这里对应调用流程删除接口
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (Objects.isNull(portalRequest)) {
|
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
|||||||
protected void processCompleted(FlowableEngineEntityEvent event) {
|
protected void processCompleted(FlowableEngineEntityEvent event) {
|
||||||
// 流程完成事件,对应流程办结
|
// 流程完成事件,对应流程办结
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (portalRequest == null) {
|
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
|||||||
protected void taskAssigned(FlowableEngineEntityEvent event) {
|
protected void taskAssigned(FlowableEngineEntityEvent event) {
|
||||||
// 任务分配事件,对应待办
|
// 任务分配事件,对应待办
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (portalRequest == null) {
|
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ public class BpmPortalTodoEventListener extends AbstractFlowableEngineEventListe
|
|||||||
protected void taskCompleted(FlowableEngineEntityEvent event) {
|
protected void taskCompleted(FlowableEngineEntityEvent event) {
|
||||||
// 任务完成事件,这里处理任务已办
|
// 任务完成事件,这里处理任务已办
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
if (portalRequest == null) {
|
if (!Objects.requireNonNull(portalRequest).available()) {
|
||||||
// 如果没有配置待办平台,则结束这个监听任务的执行
|
// 如果没有配置待办平台,则结束这个监听任务的执行
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jeelowcode.service.bpm.config.framework.portal.core;
|
|||||||
|
|
||||||
import cn.hutool.http.Header;
|
import cn.hutool.http.Header;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
|
||||||
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.*;
|
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.*;
|
||||||
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -159,4 +160,13 @@ public class PortalRequest {
|
|||||||
return JsonUtils.parseObject(httpRequest.execute().body(), PortalTodoResponseDTO.class);
|
return JsonUtils.parseObject(httpRequest.execute().body(), PortalTodoResponseDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查当前PortalRequest实例是否可用
|
||||||
|
*
|
||||||
|
* @return 当sysCode、domain和protocol都不为空时返回true,否则返回false
|
||||||
|
*/
|
||||||
|
public boolean available() {
|
||||||
|
return !StringUtils.isBlank(sysCode) && !StringUtils.isBlank(domain) && !StringUtils.isBlank(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class BpmProcessInstanceCopyServiceImpl implements IBpmProcessInstanceCop
|
|||||||
// 3.推送给待办系统
|
// 3.推送给待办系统
|
||||||
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
PortalRequest portalRequest = SpringUtils.getBean(PortalRequest.class);
|
||||||
// 3.1 如果没有配置待办平台,则结束这个监听任务的执行
|
// 3.1 如果没有配置待办平台,则结束这个监听任务的执行
|
||||||
if (ObjectUtil.isNull(portalRequest)) return;
|
if (!Objects.requireNonNull(portalRequest).available()) return;
|
||||||
// 3.2 调用待办系统,发送待办消息
|
// 3.2 调用待办系统,发送待办消息
|
||||||
try {
|
try {
|
||||||
copyList.stream().map(copy -> {
|
copyList.stream().map(copy -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user