Browse Source

提交项目 优化

tags/24080901
PoffyZhang 1 year ago
parent
commit
407a88f927
8 changed files with 37 additions and 16 deletions
  1. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  2. +13
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java
  3. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  4. +1
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java
  5. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  6. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java
  7. +5
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java
  8. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java

+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.handler;


import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.ningdatech.basic.model.ApiResponse; import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.utils.BizUtils;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; 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 * @Date 2021/7/21 11:26
* @Version 1.0 * @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<Object> { public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {


private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation";


+ 13
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.utils;


import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.util.StrPool; import com.ningdatech.basic.util.StrPool;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.NumberUtils; import org.springframework.util.NumberUtils;


import java.util.Arrays; 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;
}
} }

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectdeclared.controller; package com.ningdatech.pmapi.projectdeclared.controller;


import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectDto;
import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto; import com.ningdatech.pmapi.projectdeclared.entity.dto.DeclaredProjectListParamDto;


+ 1
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java View File

@@ -32,14 +32,11 @@ public class DeclaredProjectDto implements Serializable {


private Map<String,Object> formData; private Map<String,Object> formData;


@NotBlank
private String regionCode;

@NotNull @NotNull
private ProcessInstanceUserDto user; private ProcessInstanceUserDto user;


public Map<String,Object> getFormData(){ public Map<String,Object> getFormData(){
if(CollUtil.isNotEmpty(this.formData)){
if(CollUtil.isEmpty(this.formData)){
this.formData = Maps.newHashMap(); this.formData = Maps.newHashMap();
return this.formData; return this.formData;
} }


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -132,7 +132,8 @@ public class DeclaredProjectManage {
* @return * @return
*/ */
public String startTheProcess(DeclaredProjectDto dto) { 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) WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getRegionCode, regionCode)


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.projectlib.model.dto; package com.ningdatech.pmapi.projectlib.model.dto;


import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -163,6 +164,7 @@ public class ProjectDto implements Serializable {
@ApiModelProperty("立项批复资金(万元)") @ApiModelProperty("立项批复资金(万元)")
private BigDecimal approvalAmount; private BigDecimal approvalAmount;


@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime annualPlanAddTime; private LocalDateTime annualPlanAddTime;


@ApiModelProperty("核心业务-核心业务模块") @ApiModelProperty("核心业务-核心业务模块")


+ 5
- 8
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java View File

@@ -1,21 +1,17 @@
package com.ningdatech.pmapi.scheduler.task; package com.ningdatech.pmapi.scheduler.task;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch; import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.scheduler.contants.TaskContant; import com.ningdatech.pmapi.scheduler.contants.TaskContant;
import com.ningdatech.pmapi.sys.contant.RegionConst; import com.ningdatech.pmapi.sys.contant.RegionConst;
import com.ningdatech.pmapi.sys.entity.Region; import com.ningdatech.pmapi.sys.entity.Region;
import com.ningdatech.pmapi.sys.service.IRegionService; 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.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.ProcessModelService;
import com.wflow.workflow.service.WflowFormsService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -102,7 +98,7 @@ public class InitProcessTask {


String[] processList = TaskContant.Wflow.DEFAULT_PROCESS_LIST; String[] processList = TaskContant.Wflow.DEFAULT_PROCESS_LIST;
for(String processName : processList){ for(String processName : processList){
WflowModelHistorys models = new WflowModelHistorys();
WflowModelHistorysDto models = new WflowModelHistorysDto();
models.setCreated(GregorianCalendar.getInstance().getTime()); models.setCreated(GregorianCalendar.getInstance().getTime());
// models.setFormId("wf" + IdUtil.objectId()); // models.setFormId("wf" + IdUtil.objectId());
models.setVersion(1); models.setVersion(1);
@@ -110,7 +106,8 @@ public class InitProcessTask {
// models.setProcessDefId("pd" + IdUtil.objectId()); // models.setProcessDefId("pd" + IdUtil.objectId());
models.setFormName(processName); models.setFormName(processName);
models.setRegionCode(region.getRegionCode()); 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.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}");
models.setFormItems("[]"); models.setFormItems("[]");




+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.sys.controller; package com.ningdatech.pmapi.sys.controller;


import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.model.PageVo;
import com.wflow.bean.dto.WflowModelHistorysDto;
import com.wflow.bean.entity.WflowModelHistorys; import com.wflow.bean.entity.WflowModelHistorys;
import com.wflow.bean.vo.WflowModelVo; import com.wflow.bean.vo.WflowModelVo;
import com.wflow.service.ModelGroupService; import com.wflow.service.ModelGroupService;
@@ -46,8 +47,8 @@ public class SysProcdefController {


@ApiOperation(value = "系统流程配置保存", notes = "系统流程配置保存") @ApiOperation(value = "系统流程配置保存", notes = "系统流程配置保存")
@PostMapping("/save") @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 = "系统流程配置启用(停用)") @ApiOperation(value = "系统流程配置启用(停用)", notes = "系统流程配置启用(停用)")


Loading…
Cancel
Save