From a83b067c073b5fc53b1394ba273366608c3623b9 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 30 Jan 2023 17:31:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E5=B9=B6=E4=B8=94=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/scheduler/task/InitProcessTask.java | 32 ++++++---------------- 1 file changed, 9 insertions(+), 23 deletions(-) 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);