|
|
|
@ -4,13 +4,14 @@ import com.hnac.hzims.middle.processflow.entity.ProcessDict;
|
|
|
|
|
import com.hnac.hzims.middle.processflow.service.ProcessDictService; |
|
|
|
|
import com.hnac.hzims.middle.processflow.strategy.service.ProcessService; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.flow.core.entity.BladeFlow; |
|
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
|
import org.springblade.message.MessageConstants; |
|
|
|
|
import org.springblade.message.dto.BusinessMessageDTO; |
|
|
|
|
import org.springblade.message.dto.BusinessMessageFlowDTO; |
|
|
|
|
import org.springblade.message.fegin.IMessageClient; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
@ -60,7 +61,7 @@ public abstract class ProcessAbstractService implements ProcessService {
|
|
|
|
|
log.error("开启流程失败:{}",result); |
|
|
|
|
log.error("流程信息为{}",variables); |
|
|
|
|
r.setData(variables); |
|
|
|
|
pushStartFailMessage(dictValue,Long.valueOf(taskId),userId,processName,result.getMsg()); |
|
|
|
|
pushStartFailMessage(dictValue,taskId,userId,processName,result.getMsg()); |
|
|
|
|
} |
|
|
|
|
return r; |
|
|
|
|
}catch (Exception e){ |
|
|
|
@ -85,9 +86,9 @@ public abstract class ProcessAbstractService implements ProcessService {
|
|
|
|
|
// return r;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public void pushStartFailMessage(String dictValue,Long taskId, String userId, String content,String reason) { |
|
|
|
|
public void pushStartFailMessage(String dictValue,String taskId, String userId, String content,String reason) { |
|
|
|
|
ProcessDict processDict = processDictService.selectDictLabelByKey(dictValue); |
|
|
|
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
|
|
|
|
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO(); |
|
|
|
|
// 计划Id
|
|
|
|
|
message.setTaskId(taskId); |
|
|
|
|
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); |
|
|
|
@ -108,13 +109,14 @@ public abstract class ProcessAbstractService implements ProcessService {
|
|
|
|
|
} |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
message.setUserIds(userId); |
|
|
|
|
messageClient.sendAppAndWsMsgByUsers(message); |
|
|
|
|
messageClient.sendAppAndWsMsgByUsersFlow(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void pushFailMessage(Long taskId, String proessKey, String userId, String content,String reason,String deptId) { |
|
|
|
|
public void pushFailMessage(String taskId, String proessKey, String content,String reason,String deptId) { |
|
|
|
|
ProcessDict processDict = processDictService.selectDictLabelByKey(proessKey); |
|
|
|
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
|
|
|
|
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO(); |
|
|
|
|
// BusinessMessageDTO message = new BusinessMessageDTO();
|
|
|
|
|
// 计划Id
|
|
|
|
|
message.setTaskId(taskId); |
|
|
|
|
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); |
|
|
|
@ -126,18 +128,27 @@ public abstract class ProcessAbstractService implements ProcessService {
|
|
|
|
|
processDict.getDictLabel(), reason); |
|
|
|
|
message.setContent(res); |
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.valueOf(deptId), PROJECT_MANAGER); |
|
|
|
|
R<List<User>> userListR = userClient.queryUserByRoleAlias("200000", Long.valueOf(deptId), PROJECT_MANAGER); |
|
|
|
|
User admin = userClient.userByAccount("200000", "admin").getData(); |
|
|
|
|
User createUser = userClient.userInfoById(Long.valueOf(userId)).getData(); |
|
|
|
|
message.setDeptId(createUser.getCreateDept()); |
|
|
|
|
R<String> result = sysClient.getDeptName(createUser.getCreateDept()); |
|
|
|
|
message.setDeptId(Long.valueOf(deptId)); |
|
|
|
|
R<String> result = sysClient.getDeptName(Long.valueOf(deptId)); |
|
|
|
|
if (result.isSuccess()) { |
|
|
|
|
message.setDeptName(result.getData()); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isNotEmpty(userListR.getData())){ |
|
|
|
|
List<User> data = userListR.getData(); |
|
|
|
|
String userIds = data.stream().map(user -> user.getId().toString()).collect(Collectors.joining(",")); |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
message.setUserIds(userIds); |
|
|
|
|
messageClient.sendAppAndWsMsgByUsers(message); |
|
|
|
|
}else { |
|
|
|
|
R<List<User>> listR = userClient.queryUserByRoleAlias("200000", Long.valueOf(20000001), PROJECT_MANAGER); |
|
|
|
|
if (ObjectUtil.isEmpty(listR)||CollectionUtil.isEmpty(listR.getData())){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
List<User> data =listR.getData(); |
|
|
|
|
String userIds = data.stream().map(user -> user.getId().toString()).collect(Collectors.joining(",")); |
|
|
|
|
message.setUserIds(userIds); |
|
|
|
|
} |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
messageClient.sendAppAndWsMsgByUsersFlow(message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|