diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java index af34f7c..5bd8fee 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java @@ -18,6 +18,7 @@ import com.wflow.workflow.service.ProcessModelService; import com.wflow.workflow.service.WflowFormsService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -46,7 +47,7 @@ public class InitProcessTask { private final WflowModelsMapper modelsMapper; // 定时更新车辆状态 - @Scheduled(cron = "0 52 13 29 1 ?") + @Scheduled(cron = "0 22 17 30 1 ?") public void doTask() throws UnknownHostException { if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); @@ -110,34 +111,19 @@ public class InitProcessTask { for(String processName : processList){ WflowModelHistorys models = new WflowModelHistorys(); models.setCreated(GregorianCalendar.getInstance().getTime()); - models.setFormId("wf" + IdUtil.objectId()); +// models.setFormId("wf" + IdUtil.objectId()); models.setVersion(1); models.setGroupId(1); - models.setProcessDefId("pd" + IdUtil.objectId()); +// models.setProcessDefId("pd" + IdUtil.objectId()); models.setFormName(processName); models.setRegionCode(region.getRegionCode()); + models.setProcess("{\"id\":\"root\",\"desc\":\"任何人\",\"name\":\"发起人\",\"type\":\"ROOT\",\"props\":{},\"children\":{},\"parentId\":null}"); + models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); + models.setFormItems("[]"); - WflowModels wflowModels = new WflowModels(); - BeanUtil.copyProperties(models, wflowModels); - wflowModels.setFormId(models.getFormId()); - wflowModels.setIsDelete(false); - wflowModels.setIsStop(false); - wflowModels.setUpdated(new Date()); - wflowModels.setSort(0); - wflowModels.setVersion(1); - wflowModels.setProcessDefId(models.getProcessDefId()); - wflowModels.setFormName(models.getFormName()); - - //留给前端去初始化配置 -// wflowModels.setFormItems(JSON.toJSONString(form)); - wflowModels.setGroupId(models.getGroupId()); - wflowModels.setRegionCode(models.getRegionCode()); - //留给前端去初始化配置 -// model.setProcess(); -// model.setSettings(); - if(modelHistoriesMapper.insert(models) > 0){ + if(StringUtils.isNotBlank(processModelService.saveProcess(models))){ //初始的流程在部署表也存一份,用来查询 - if(modelsMapper.insert(wflowModels) > 0){ + if(StringUtils.isNotBlank(processModelService.deployProcess(models.getFormId()))){ log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getName(),processName); }else{ log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getName(),processName);