From acaf04b8e24861177bbcadc63ec08f0f1d02d518 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sun, 29 Jan 2023 17:37:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=B5=81=E7=A8=8B=E5=92=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=85=8D=E7=BD=AE=20=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrganizationProcdefController.java | 2 +- .../pmapi/scheduler/contants/TaskContant.java | 4 +- .../pmapi/scheduler/task/InitProcessTask.java | 64 +++++++++++++--------- .../pmapi/sys/controller/SysFormController.java | 25 +++++++++ .../pmapi/sys/controller/SysProcdefController.java | 20 ++++--- 5 files changed, 76 insertions(+), 39 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java index fa9badf..428f886 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/OrganizationProcdefController.java @@ -54,7 +54,7 @@ public class OrganizationProcdefController { return orgProcessModelService.saveProcess(wflowOrgProcdefDto); } - @ApiOperation(value = "单位流程配置保存", notes = "单位流程配置保存") + @ApiOperation(value = "单位流程配置部署", notes = "单位流程配置部署") @PostMapping("/deploy/{processDefId}") public String deploy(@Validated @PathVariable String processDefId) { return orgProcessModelService.deployProcess(processDefId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java index 5868441..7f689f9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/contants/TaskContant.java @@ -1,7 +1,5 @@ package com.ningdatech.pmapi.scheduler.contants; -import java.math.BigDecimal; - /** * @author PoffyZhang * @Classname TaskContant @@ -19,5 +17,7 @@ public interface TaskContant { class Wflow { public static final String DEFAULT_FORM_NAME = "丽水申报项目表单"; + + public static final String[] DEFAULT_PROCESS_LIST = {"单位内部审批流程","项目预审审批流程","部门联合审批流程","建设方案审批流程","验收申报审批流程"}; } } 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 e2df0b0..aa310e0 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 @@ -54,7 +54,7 @@ public class InitProcessTask { private final WflowModelsMapper modelsMapper; // 定时更新车辆状态 - @Scheduled(cron = "0 47 15 28 1 ?") + @Scheduled(cron = "0 52 13 29 1 ?") public void doTask() throws UnknownHostException { if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); @@ -114,35 +114,45 @@ public class InitProcessTask { // continue; // } - WflowModelHistorys models = new WflowModelHistorys(); - models.setCreated(GregorianCalendar.getInstance().getTime()); - models.setFormId("wf" + IdUtil.objectId()); - models.setVersion(1); - models.setGroupId(1); - models.setProcessDefId("pd" + IdUtil.objectId()); - models.setRegionCode(region.getRegionCode()); - models.setFormName(TaskContant.Wflow.DEFAULT_FORM_NAME); - - 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.setProcessDefId(models.getProcessDefId()); - wflowModels.setFormName(models.getFormName()); + String[] processList = TaskContant.Wflow.DEFAULT_PROCESS_LIST; + for(String processName : processList){ + WflowModelHistorys models = new WflowModelHistorys(); + models.setCreated(GregorianCalendar.getInstance().getTime()); + models.setFormId("wf" + IdUtil.objectId()); + models.setVersion(1); + models.setGroupId(1); + models.setProcessDefId("pd" + IdUtil.objectId()); + models.setFormName(processName); + models.setRegionCode(region.getRegionCode()); + + 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()); + wflowModels.setGroupId(models.getGroupId()); + wflowModels.setRegionCode(models.getRegionCode()); + //留给前端去初始化配置 // model.setProcess(); // model.setSettings(); - if(modelHistoriesMapper.insert(models) > 0){ - //初始的流程在部署表也存一份,用来查询 - modelsMapper.insert(wflowModels); - log.info("当前区域 【{}】 流程数据已经保存成功",region.getName()); - }else{ - log.info("当前区域 【{}】 流程数据已经保存失败",region.getName()); + if(modelHistoriesMapper.insert(models) > 0){ + //初始的流程在部署表也存一份,用来查询 + if(modelsMapper.insert(wflowModels) > 0){ + log.info("当前区域 【{}】 流程名[{}] 流程数据已经保存成功",region.getName(),processName); + }else{ + log.info("当前区域 【{}】 流程名[{}] 流程数据保存失败",region.getName(),processName); + } + }else{ + log.info("当前区域 【{}】流程名[{}] 流程数据保存失败",region.getName(),processName); + } } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysFormController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysFormController.java index e0cc4c2..994541c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysFormController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysFormController.java @@ -1,10 +1,35 @@ package com.ningdatech.pmapi.sys.controller; +import com.ningdatech.basic.model.PageVo; +import com.wflow.bean.vo.WflowFormVo; +import com.wflow.bean.vo.WflowModelVo; +import com.wflow.workflow.service.FormService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + /** * @Classname SysProcdefController * @Description * @Date 2023/1/18 14:28 * @Author PoffyZhang */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/sys/form") +@Api(value = "SysForm", tags = "系统管理-表单配置") +@RequiredArgsConstructor public class SysFormController { + + private final FormService formService; + + @ApiOperation(value = "获取系统表单", notes = "获取系统表单") + @GetMapping("/{regionCode}") + public WflowFormVo list(@PathVariable String regionCode) { + return formService.getFormByRegionCode(regionCode); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java index 05284fd..e7670b5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java @@ -1,16 +1,14 @@ package com.ningdatech.pmapi.sys.controller; import com.ningdatech.basic.model.PageVo; -import com.wflow.bean.vo.OrgProcdefVo; +import com.wflow.bean.vo.WflowModelVo; +import com.wflow.service.ModelGroupService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @Classname SysProcdefController @@ -26,14 +24,18 @@ import org.springframework.web.bind.annotation.RestController; @RequiredArgsConstructor public class SysProcdefController { -// private final + private final ModelGroupService modelGroupService; @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") @GetMapping("/list") - public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNum, + public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) { -// return orgProcdefService.getOrgProcessByOrgCode(orgCode,pageNum,pageSize); - return PageVo.empty(); + return modelGroupService.getModelsPage(regionCode,pageNum,pageSize); } + @ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情") + @GetMapping("/detail/{formId}") + public Object list(@PathVariable String formId) { + return modelGroupService.getModelById(formId); + } }