|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.hnac.hzims.common.utils.DateUtil; |
|
|
|
import com.hnac.hzims.common.utils.DateUtil; |
|
|
|
import com.hnac.hzims.message.MessageConstants; |
|
|
|
import com.hnac.hzims.message.MessageConstants; |
|
|
@ -288,10 +289,11 @@ public class MaintenanceServiceImpl implements MaintenanceService { |
|
|
|
* @param taskEntity |
|
|
|
* @param taskEntity |
|
|
|
* @param finalPlanEntity |
|
|
|
* @param finalPlanEntity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) { |
|
|
|
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) { |
|
|
|
DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition(); |
|
|
|
// DefaultTransactionDefinition = new DefaultTransactionDefinition();
|
|
|
|
defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); |
|
|
|
// defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
|
|
|
TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition); |
|
|
|
// TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition);
|
|
|
|
taskEntity.setId(null); |
|
|
|
taskEntity.setId(null); |
|
|
|
taskEntity.setCreateTime(new Date()); |
|
|
|
taskEntity.setCreateTime(new Date()); |
|
|
|
taskEntity.setUpdateTime(new Date()); |
|
|
|
taskEntity.setUpdateTime(new Date()); |
|
|
@ -322,27 +324,21 @@ public class MaintenanceServiceImpl implements MaintenanceService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
taskService.save(taskEntity); |
|
|
|
taskService.save(taskEntity); |
|
|
|
dataSourceTransactionManager.commit(transaction); |
|
|
|
// dataSourceTransactionManager.commit(transaction);
|
|
|
|
//启动流程
|
|
|
|
//启动流程
|
|
|
|
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag); |
|
|
|
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag); |
|
|
|
//推送消息
|
|
|
|
LambdaUpdateWrapper<OperMaintenanceTaskEntity> taskQueryWrapper = Wrappers.<OperMaintenanceTaskEntity>lambdaUpdate() |
|
|
|
CompletableFuture<Void> operMaintenanceTaskEntityCompletableFuture = |
|
|
|
.set(OperMaintenanceTaskEntity::getProcessInstanceId, processInstanceId) |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
.eq(OperMaintenanceTaskEntity::getId, taskEntity.getId()); |
|
|
|
taskEntity.setProcessInstanceId(processInstanceId); |
|
|
|
taskService.update(taskQueryWrapper); |
|
|
|
taskService.updateById(taskEntity); |
|
|
|
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate() |
|
|
|
finalPlanEntity.setCreateTaskTime(new Date()); |
|
|
|
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date()) |
|
|
|
maintenancePlanService.updateById(finalPlanEntity); |
|
|
|
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId()); |
|
|
|
|
|
|
|
maintenancePlanService.update(planQueryWrapper); |
|
|
|
|
|
|
|
executor.execute(() -> { |
|
|
|
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId()); |
|
|
|
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId()); |
|
|
|
//推送消息
|
|
|
|
|
|
|
|
this.pushTaskMessage(maintenanceTask); |
|
|
|
this.pushTaskMessage(maintenanceTask); |
|
|
|
}, executor); |
|
|
|
}); |
|
|
|
//启动队列
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
CompletableFuture.allOf(operMaintenanceTaskEntityCompletableFuture).get(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|