From 407a88f927bc7b0c15f1f69114e6b22cc7d3b5a8 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Sat, 11 Feb 2023 22:40:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/handler/GlobalResponseHandler.java | 11 ++++++++++- .../java/com/ningdatech/pmapi/common/utils/BizUtils.java | 13 +++++++++++++ .../controller/DeclaredProjectController.java | 1 + .../projectdeclared/entity/dto/DeclaredProjectDto.java | 5 +---- .../pmapi/projectdeclared/manage/DeclaredProjectManage.java | 3 ++- .../ningdatech/pmapi/projectlib/model/dto/ProjectDto.java | 2 ++ .../ningdatech/pmapi/scheduler/task/InitProcessTask.java | 13 +++++-------- .../pmapi/sys/controller/SysProcdefController.java | 5 +++-- 8 files changed, 37 insertions(+), 16 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java index eb67c58..a895b8f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.handler; import cn.hutool.json.JSONUtil; import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.pmapi.common.utils.BizUtils; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -16,7 +17,15 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; * @Date 2021/7/21 11:26 * @Version 1.0 **/ -@RestControllerAdvice(basePackages = {"com.ningdatech.pmapi.fiscal.controller"}) +@RestControllerAdvice(basePackages = { + "com.ningdatech.pmapi.fiscal.controller", + "com.ningdatech.pmapi.organization.controller", + "com.ningdatech.pmapi.projectdeclared.controller", + "com.ningdatech.pmapi.projectlib.controller", + "com.ningdatech.pmapi.sys.controller", + "com.ningdatech.pmapi.todocenter.controller", + "com.ningdatech.pmapi.user.controller" +}) public class GlobalResponseHandler implements ResponseBodyAdvice { private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java index 20cf2f1..71d33cc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.utils; import cn.hutool.core.util.StrUtil; import com.ningdatech.basic.util.StrPool; +import org.apache.commons.lang3.StringUtils; import org.springframework.util.NumberUtils; import java.util.Arrays; @@ -50,4 +51,16 @@ public class BizUtils { } } + public static boolean getJSONType(String str) { + boolean result = false; + if (StringUtils.isNotBlank(str)) { + str = str.trim(); + if (str.startsWith("{") && str.endsWith("}")) { + result = true; + } else if (str.startsWith("[") && str.endsWith("]")) { + result = true; + } + } + return result; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java index 3a3b982..3764f11 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.projectdeclared.controller; +import com.ningdatech.basic.model.ApiResponse; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java index 9692307..31e2e9d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java @@ -32,14 +32,11 @@ public class DeclaredProjectDto implements Serializable { private Map formData; - @NotBlank - private String regionCode; - @NotNull private ProcessInstanceUserDto user; public Map getFormData(){ - if(CollUtil.isNotEmpty(this.formData)){ + if(CollUtil.isEmpty(this.formData)){ this.formData = Maps.newHashMap(); return this.formData; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 7d7a76b..75e3c3a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -132,7 +132,8 @@ public class DeclaredProjectManage { * @return */ public String startTheProcess(DeclaredProjectDto dto) { - String regionCode = dto.getRegionCode(); + ProjectDto projectInfo = dto.getProjectInfo(); + String regionCode = projectInfo.getAreaCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) .eq(WflowModels::getRegionCode, regionCode) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java index e696527..03c465c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.projectlib.model.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -163,6 +164,7 @@ public class ProjectDto implements Serializable { @ApiModelProperty("立项批复资金(万元)") private BigDecimal approvalAmount; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") private LocalDateTime annualPlanAddTime; @ApiModelProperty("核心业务-核心业务模块") 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 1deb6c9..7f27ebe 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 @@ -1,21 +1,17 @@ package com.ningdatech.pmapi.scheduler.task; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.StopWatch; -import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; import com.ningdatech.pmapi.scheduler.contants.TaskContant; import com.ningdatech.pmapi.sys.contant.RegionConst; import com.ningdatech.pmapi.sys.entity.Region; import com.ningdatech.pmapi.sys.service.IRegionService; -import com.wflow.bean.entity.WflowModelHistorys; +import com.wflow.bean.dto.WflowModelHistorysDto; import com.wflow.bean.entity.WflowModels; -import com.wflow.mapper.WflowModelHistorysMapper; -import com.wflow.mapper.WflowModelsMapper; +import com.wflow.workflow.bean.process.ProcessNode; 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; @@ -102,7 +98,7 @@ public class InitProcessTask { String[] processList = TaskContant.Wflow.DEFAULT_PROCESS_LIST; for(String processName : processList){ - WflowModelHistorys models = new WflowModelHistorys(); + WflowModelHistorysDto models = new WflowModelHistorysDto(); models.setCreated(GregorianCalendar.getInstance().getTime()); // models.setFormId("wf" + IdUtil.objectId()); models.setVersion(1); @@ -110,7 +106,8 @@ public class InitProcessTask { // models.setProcessDefId("pd" + IdUtil.objectId()); models.setFormName(processName); models.setRegionCode(region.getRegionCode()); - models.setProcess("{\"id\":\"root\",\"desc\":\"任何人\",\"name\":\"发起人\",\"type\":\"ROOT\",\"props\":{},\"children\":{},\"parentId\":null}"); + ProcessNode processNode = new ProcessNode(); + models.setProcess(processNode); models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); models.setFormItems("[]"); 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 7d11e1f..82953e1 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,6 +1,7 @@ package com.ningdatech.pmapi.sys.controller; import com.ningdatech.basic.model.PageVo; +import com.wflow.bean.dto.WflowModelHistorysDto; import com.wflow.bean.entity.WflowModelHistorys; import com.wflow.bean.vo.WflowModelVo; import com.wflow.service.ModelGroupService; @@ -46,8 +47,8 @@ public class SysProcdefController { @ApiOperation(value = "系统流程配置保存", notes = "系统流程配置保存") @PostMapping("/save") - public String save(@Validated @RequestBody WflowModelHistorys modelHistory) { - return processModelService.saveProcess(modelHistory); + public String save(@Validated @RequestBody WflowModelHistorysDto dto) { + return processModelService.saveProcess(dto); } @ApiOperation(value = "系统流程配置启用(停用)", notes = "系统流程配置启用(停用)")