|
|
|
@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.task.api.history.HistoricTaskInstance; |
|
|
|
import org.flowable.task.api.history.HistoricTaskInstance; |
|
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
|
|
|
|
import org.springblade.core.log.model.LogError; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
@ -27,6 +28,7 @@ import org.springblade.plugin.operation.workorder.service.IWorkOrderService; |
|
|
|
import org.springblade.plugin.workbench.cache.FlowCache; |
|
|
|
import org.springblade.plugin.workbench.cache.FlowCache; |
|
|
|
import org.springblade.plugin.workbench.entity.AutoStartModel; |
|
|
|
import org.springblade.plugin.workbench.entity.AutoStartModel; |
|
|
|
import org.springblade.plugin.workbench.enumutil.RepeatEnum; |
|
|
|
import org.springblade.plugin.workbench.enumutil.RepeatEnum; |
|
|
|
|
|
|
|
import org.springblade.plugin.workbench.feign.ProcessErrorLogClient; |
|
|
|
import org.springblade.plugin.workbench.mapper.BladeManMadeMapper; |
|
|
|
import org.springblade.plugin.workbench.mapper.BladeManMadeMapper; |
|
|
|
import org.springblade.plugin.workbench.service.IAutoStartModelService; |
|
|
|
import org.springblade.plugin.workbench.service.IAutoStartModelService; |
|
|
|
import org.springblade.plugin.workbench.util.MyDateUtil; |
|
|
|
import org.springblade.plugin.workbench.util.MyDateUtil; |
|
|
|
@ -40,6 +42,8 @@ import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
@ -70,13 +74,23 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
|
|
|
|
|
|
|
|
private final IWorkOrderService workOrderService; |
|
|
|
private final IWorkOrderService workOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ProcessErrorLogClient processErrorLogClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void saveProcessErrorLog(@RequestBody LogError logError){ |
|
|
|
|
|
|
|
processErrorLogClient.saveErrorLog(logError); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> bladeManMadeVariabList() { |
|
|
|
public List<Map<String, Object>> bladeManMadeVariabList() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<AutoStartModel> queryWrapper = Wrappers.lambdaQuery(); |
|
|
|
LambdaQueryWrapper<AutoStartModel> queryWrapper = Wrappers.lambdaQuery(); |
|
|
|
// status = 10 isBreak = 0才是可以自动任务,status = 1,isBreak = 0刚建立,status=1 ,isBreak = 1删除,不自动执行了
|
|
|
|
// status = 10 isBreak = 0才是可以自动任务,status = 1,isBreak = 0刚建立,status=1 ,isBreak = 1删除,不自动执行了
|
|
|
|
queryWrapper.ne(AutoStartModel::getIsBreak, 1); |
|
|
|
queryWrapper.ne(AutoStartModel::getIsBreak, 1); |
|
|
|
List<AutoStartModel> autoStartModels = baseMapper.selectList(queryWrapper); |
|
|
|
List<AutoStartModel> autoStartModels = baseMapper.selectList(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> maps = new ArrayList<>(); |
|
|
|
List<Map<String,Object>> maps = new ArrayList<>(); |
|
|
|
if(autoStartModels.size() > 0){ |
|
|
|
if(autoStartModels.size() > 0){ |
|
|
|
autoStartModels.forEach(bl ->{ |
|
|
|
autoStartModels.forEach(bl ->{ |
|
|
|
@ -116,10 +130,10 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
copy.setRepeatMode(DictBizCache.getById(l.getRepeatMode()).getDictValue()); |
|
|
|
copy.setRepeatMode(DictBizCache.getById(l.getRepeatMode()).getDictValue()); |
|
|
|
copy.setMaintenanceCompany(UserCache.getUser(l.getMaintenanceCompany()).getName()); |
|
|
|
copy.setMaintenanceCompany(UserCache.getUser(l.getMaintenanceCompany()).getName()); |
|
|
|
|
|
|
|
|
|
|
|
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(l.getProcessInstanceId()) |
|
|
|
List<HistoricTaskInstance> listHisInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(l.getProcessInstanceId()) |
|
|
|
.orderByHistoricTaskInstanceStartTime().desc().list().get(0); |
|
|
|
.orderByHistoricTaskInstanceStartTime().desc().list(); |
|
|
|
|
|
|
|
|
|
|
|
copy.setTaskId(historicTaskInstance.getId()); |
|
|
|
copy.setTaskId(Func.isEmpty(listHisInstance) ? "" : listHisInstance.get(0).getId()); |
|
|
|
//模块和数据表
|
|
|
|
//模块和数据表
|
|
|
|
Integer type = l.getType(); |
|
|
|
Integer type = l.getType(); |
|
|
|
if(type == 1){//系统
|
|
|
|
if(type == 1){//系统
|
|
|
|
@ -153,7 +167,7 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
baseMapper.updateById(autoStartModel); |
|
|
|
baseMapper.updateById(autoStartModel); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
FlowCache.clearBladeManMadeCache(); |
|
|
|
// FlowCache.clearBladeManMadeCache();
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -196,8 +210,9 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean newWorkOrder(String processInstanceId,Map<String,Object> variables){ |
|
|
|
public boolean newWorkOrder(String processInstanceId,Map<String,Object> variables){ |
|
|
|
|
|
|
|
boolean save = false; |
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
|
|
|
|
try{ |
|
|
|
workOrder.setUploadRecord(JSON.toJSONString(variables.get("uploadrecord"))); |
|
|
|
workOrder.setUploadRecord(JSON.toJSONString(variables.get("uploadrecord"))); |
|
|
|
workOrder.setOperateSys(variables.get("xitongmingchengshujuku").toString()); |
|
|
|
workOrder.setOperateSys(variables.get("xitongmingchengshujuku").toString()); |
|
|
|
workOrder.setOperateModule(variables.get("xitongmokuaishujubiao").toString()); |
|
|
|
workOrder.setOperateModule(variables.get("xitongmokuaishujubiao").toString()); |
|
|
|
@ -223,7 +238,7 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
workOrder.setIsFinish(1); |
|
|
|
workOrder.setIsFinish(1); |
|
|
|
workOrder.setFinishTime(new Date()); |
|
|
|
workOrder.setFinishTime(new Date()); |
|
|
|
} |
|
|
|
} |
|
|
|
boolean save = false; |
|
|
|
|
|
|
|
save = workOrderService.save(workOrder); |
|
|
|
save = workOrderService.save(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
int retryNum = 0; |
|
|
|
int retryNum = 0; |
|
|
|
@ -236,8 +251,12 @@ public class AutoStartModelServiceImpl extends BaseServiceImpl<BladeManMadeMappe |
|
|
|
retryNum ++; |
|
|
|
retryNum ++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
}finally { |
|
|
|
return save; |
|
|
|
return save; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存工作流程,要做的事情 |
|
|
|
* 保存工作流程,要做的事情 |
|
|
|
|