|
|
|
@ -3,6 +3,9 @@ package com.hnac.hzims.operational.access.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.hnac.hzims.message.MessageConstants; |
|
|
|
|
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
|
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
|
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; |
|
|
|
|
import com.hnac.hzims.operational.access.dto.*; |
|
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; |
|
|
|
@ -22,6 +25,9 @@ import org.springblade.flow.core.entity.BladeFlow;
|
|
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
|
import org.springblade.flow.core.utils.FlowUtil; |
|
|
|
|
import org.springblade.flow.core.utils.TaskUtil; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
@ -46,8 +52,14 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
|
|
|
|
|
|
|
|
|
|
private final AccessTaskV4Service accessTaskV4Service; |
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
private final IFlowClient flowClient; |
|
|
|
|
|
|
|
|
|
private final IUserClient userClient; |
|
|
|
|
|
|
|
|
|
private final IMessageClient messageClient; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 开启检修计划流程 |
|
|
|
|
* @param entity |
|
|
|
@ -178,12 +190,21 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
|
|
|
|
|
entity.setTaskName("流程结束"); |
|
|
|
|
entity.setNextStepOperator("流程结束,无需人员处理"); |
|
|
|
|
entity.setActEndTime(new Date()); |
|
|
|
|
return this.planService.updateById(entity); |
|
|
|
|
// 审核不通过
|
|
|
|
|
} else if(ObjectUtil.isNotEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){ |
|
|
|
|
String content = "您有一条检修计划待调整!检修计划名称:".concat(entity.getName()) |
|
|
|
|
.concat(",当前环节:") |
|
|
|
|
.concat(processWorkFlowResponse.getTaskName()); |
|
|
|
|
this.sendMessage(entity,processWorkFlowResponse.getUserId(),content); |
|
|
|
|
return this.planService.updateById(entity); |
|
|
|
|
} |
|
|
|
|
this.planService.updateById(entity); |
|
|
|
|
this.saveAccessMaterial(entity); |
|
|
|
|
this.saveAccessContent(entity); |
|
|
|
|
// 开启检修任务
|
|
|
|
|
this.startTaskProcess(entity); |
|
|
|
|
String content = "您有一条检修计划待审批!检修计划名称:".concat(entity.getName()) |
|
|
|
|
.concat(",当前环节:") |
|
|
|
|
.concat(processWorkFlowResponse.getTaskName()); |
|
|
|
|
this.sendMessage(entity,processWorkFlowResponse.getUserId(),content); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -220,4 +241,32 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
|
|
|
|
|
accessTaskV4Service.startProcessV4(task); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 推送业务流程消息 |
|
|
|
|
* @param entity |
|
|
|
|
* @param userId |
|
|
|
|
* @param content |
|
|
|
|
*/ |
|
|
|
|
private void sendMessage(AccessPlanV4DTO entity, String userId, String content) { |
|
|
|
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
|
|
|
|
// 计划Id
|
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); |
|
|
|
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OVERHAUL_PLAN.getKey()); |
|
|
|
|
// 主题
|
|
|
|
|
message.setSubject(MessageConstants.BusinessClassifyEnum.OVERHAUL_PLAN.getDescription()); |
|
|
|
|
message.setDeptId(entity.getCreateDept()); |
|
|
|
|
R<String> result = sysClient.getDeptName(entity.getCreateDept()); |
|
|
|
|
if (result.isSuccess()) { |
|
|
|
|
message.setDeptName(result.getData()); |
|
|
|
|
} |
|
|
|
|
// 内容
|
|
|
|
|
message.setContent(content); |
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
User admin = userClient.userByAccount("200000", "admin").getData(); |
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
message.setUserIds(userId); |
|
|
|
|
messageClient.sendAppAndWsMsgByUsers(message); |
|
|
|
|
} |
|
|
|
|
} |