CMM 1 ano atrás
pai
commit
a3395ad252
11 arquivos alterados com 68 adições e 31 exclusões
  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. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDto.java
  7. +13
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java
  8. +5
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java
  9. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java
  10. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java
  11. +18
    -2
      pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java

+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java Ver arquivo

@@ -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<Object> {

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


+ 13
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/utils/BizUtils.java Ver arquivo

@@ -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;
}
}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java Ver arquivo

@@ -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;


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

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

private Map<String,Object> formData;

@NotBlank
private String regionCode;

@NotNull
private ProcessInstanceUserDto user;

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


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Ver arquivo

@@ -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)


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectApplicationDto.java Ver arquivo

@@ -25,7 +25,7 @@ public class ProjectApplicationDto implements Serializable {
private Long id;

@ApiModelProperty("项目ID")
private String projectId;
private Long projectId;

@ApiModelProperty("是否初次建设 0否 1是")
private Integer isFirst;


+ 13
- 11
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDto.java Ver arquivo

@@ -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;
@@ -57,13 +58,13 @@ public class ProjectDto implements Serializable {
private String contactPhone;

@ApiModelProperty("建设单位名称")
private String buildUnitName;
private String buildOrgName;

@ApiModelProperty("建设单位统一社会信用代码")
private String buildUnitCode;
private String buildOrgCode;

@ApiModelProperty("建设单位浙政钉ID")
private String buildUnitZheJiangGovernmentDingId;
private String buildOrgZheJiangGovDingId;

@ApiModelProperty("项目类型 1:建设 2:运维")
private Integer projectType;
@@ -122,10 +123,10 @@ public class ProjectDto implements Serializable {
private BigDecimal declareHaveAmount;

@ApiModelProperty("资金申报情况-政府投资-本级财政资金(万元)")
private BigDecimal declareGovernmentOwnFinanceAmount;
private BigDecimal declareGovOwnFinanceAmount;

@ApiModelProperty("资金申报情况-政府投资-上级补助资金(万元)")
private BigDecimal declareGovernmentSuperiorFinanceAmount;
private BigDecimal declareGovSuperiorFinanceAmount;

@ApiModelProperty("银行贷款(万元)")
private BigDecimal declareBankLendingAmount;
@@ -149,10 +150,10 @@ public class ProjectDto implements Serializable {
private BigDecimal annualPlanHaveAmount;

@ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)")
private BigDecimal annualPlanGovernmentOwnFinanceAmount;
private BigDecimal annualPlanGovOwnFinanceAmount;

@ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)")
private BigDecimal annualPlanGovernmentSuperiorFinanceAmount;
private BigDecimal annualPlanGovSuperiorFinanceAmount;

@ApiModelProperty("年度支付计划-银行贷款(万元)")
private BigDecimal annualPlanBankLendingAmount;
@@ -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("核心业务-核心业务模块")
@@ -257,16 +259,16 @@ public class ProjectDto implements Serializable {
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("上级主管部门")
private String higherSuperUnit;
private String higherSuperOrg;

@ApiModelProperty("上级主管部门Code")
private String higherSuperUnitCode;
private String higherSuperOrgCode;

@ApiModelProperty("主管部门名称")
private String superUnit;
private String superOrg;

@ApiModelProperty("主管部门Code")
private String superUnitCode;
private String superOrgCode;

@ApiModelProperty("前端所需验证字段")
private Integer allApplicationsDone;


+ 5
- 8
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java Ver arquivo

@@ -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("[]");



+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcdefController.java Ver arquivo

@@ -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 = "系统流程配置启用(停用)")


+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java Ver arquivo

@@ -22,7 +22,7 @@ public class StateMachineTest extends AppTests {
@Test
public void stateMachineTest() throws Exception {
Project project = new Project();
project.setProjectStatusSecond(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);
}
}

+ 18
- 2
pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java Ver arquivo

@@ -1,11 +1,13 @@
package com.ningdatech.pmapi.sys.project;

import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import org.junit.Test;

import javax.annotation.Resource;
@@ -21,6 +23,9 @@ public class ProjectStateTest extends AppTests {
@Resource
private StateMachineUtils stateMachineUtils;

@Resource
private IProjectService projectService;

@Test
public void execute() throws Exception {
StopWatch stopWatch = new StopWatch();
@@ -30,11 +35,22 @@ public class ProjectStateTest extends AppTests {
Project project = new Project();
project.setInstCode("1");
project.setId(1L);
project.setProjectStatusFirst(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setProjectStatusSecond(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);

stopWatch.stop();
System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds());
}

@Test
public void getProject() {
StopWatch stopWatch = new StopWatch();
stopWatch.start();

Project project = projectService.getById(1);

stopWatch.stop();
System.out.println("project :" + JSON.toJSONString(project));
}
}

Carregando…
Cancelar
Salvar