Parcourir la source

Merge remote-tracking branch 'origin/master'

master
CMM il y a 1 an
Parent
révision
4a416b2899
19 fichiers modifiés avec 86 ajouts et 43 suppressions
  1. +11
    -1
      kingbasesql/project.sql
  2. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  4. +8
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  5. +5
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  6. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  7. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
  8. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java
  9. +0
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectDraftSaveDTO.java
  10. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java
  11. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java
  12. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  13. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java
  14. +7
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  15. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  16. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java
  17. +3
    -15
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  18. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java
  19. +1
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java

+ 11
- 1
kingbasesql/project.sql Voir le fichier

@@ -1,2 +1,12 @@
ALTER TABLE PUBLIC."nd_project" ADD "org_credit_code" VARCHAR(60);
comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码';
comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码';

ALTER TABLE nd_project ADD COLUMN is_super_org int2 NOT NULL DEFAULT 0;
comment ON COLUMN nd_project.is_super_org IS '是否有主管单位';
ALTER TABLE nd_project ADD COLUMN is_higher_super_org int2 NOT NULL DEFAULT 0;
comment ON COLUMN nd_project.is_higher_super_org IS '是否有上级条线主管单位';

ALTER TABLE nd_project_draft ADD COLUMN is_super_org int2 NOT NULL DEFAULT 0;
comment ON COLUMN nd_project_draft.is_super_org IS '是否有主管单位';
ALTER TABLE nd_project_draft ADD COLUMN is_higher_super_org int2 NOT NULL DEFAULT 0;
comment ON COLUMN nd_project_draft.is_higher_super_org IS '是否有上级条线主管单位';

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/util/StateMachineUtils.java Voir le fichier

@@ -41,6 +41,21 @@ public class StateMachineUtils {
@Resource(name = "projectDeclareStateMachinePersister")
private StateMachinePersister projectDeclareStateMachinePersister;

//通过审核
public void pass(Project project) throws Exception {
execute(project,getProjectStatusPassEvent(project.getStatus()));
}

//拒绝
public void reject(Project project) throws Exception {
execute(project,getProjectStatusRejectEvent(project.getStatus()));
}

//撤回
public void withDraw(Project project) throws Exception {
execute(project,getProjectStatusWithdrawEvent(project.getStatus()));
}

public void execute(Project project, ProjectStatusChangeEvent event) throws Exception {
log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus());
// 将状态变更记录保存到项目状态变更表中


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java Voir le fichier

@@ -133,7 +133,7 @@ public class ConstructionPlanManage {
);
params.setFormData(dto.getFormData());
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("建设方案项目申报成功 【{}】", instanceId);

@@ -156,7 +156,7 @@ public class ConstructionPlanManage {
project.setInstCode(instanceId);
project.setConstructionPlanFile(constructionPlanFile);
//调用状态机 进入下一个通过状态
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
stateMachineUtils.pass(project);
projectService.updateById(project);

//保存项目和实例的关系


+ 8
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Voir le fichier

@@ -156,7 +156,9 @@ public class DeclaredProjectManage {
params.setFormData(dto.getFormData());
//开始申报
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId);
Project project = new Project();
BeanUtils.copyProperties(projectInfo,project);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("申报项目成功 【{}】", instanceId);

@@ -220,7 +222,9 @@ public class DeclaredProjectManage {
);
params.setFormData(dto.getFormData());
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId);
Project project = new Project();
BeanUtils.copyProperties(projectInfo,project);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("重新申报项目成功 【{}】", instanceId);

@@ -329,8 +333,9 @@ public class DeclaredProjectManage {
ProjectDTO projectInfo = dto.getProjectInfo();
ProjectDraft draft = new ProjectDraft();
BeanUtils.copyProperties(projectInfo, draft);
draft.setUserId(dto.getUser().getUserId());
draft.setUserId(String.valueOf(userId));
draft.setBuildOrgCode(userInfoDetails.getOrganizationCode());
draft.setBuildOrgName(userInfoDetails.getOrganizationName());
draft.setAreaCode(userInfoDetails.getRegionCode());

if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){


+ 5
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java Voir le fichier

@@ -67,7 +67,7 @@ public class DefaultDeclaredProjectManage {
.build();
}

public Map<String, OrgInfoDTO> getOrgModelInfo(Long userId) {
public Map<String, OrgInfoDTO> getOrgModelInfo(Long userId,Project project) {
Map<String, OrgInfoDTO> orgMap = new HashMap<>();

// 查出所有的单位流程配置
@@ -80,13 +80,13 @@ public class DefaultDeclaredProjectManage {
String startOrgName = startOrg.getOrganizationName();
String startOrgParentCode;
String startOrgParentName;
// 如果没有上级主管单位,由该单位自己审核
if (Objects.isNull(startOrg.getParentCode())){
// 如果申报时 上级主管单位,由该单位自己审核
if (Objects.isNull(project.getSuperOrgCode())){
startOrgParentCode = startOrgCode;
startOrgParentName = startOrgName;
}else {
startOrgParentCode = startOrg.getParentCode();
startOrgParentName = startOrg.getParentName();
startOrgParentCode = project.getSuperOrgCode();
startOrgParentName = project.getSuperOrg();
}
//查询 当前发起人及主管单位所在区域的 单位流程配置
OrgInfoDTO startOrgInfoDto = new OrgInfoDTO();
@@ -113,8 +113,6 @@ public class DefaultDeclaredProjectManage {
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto);
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto);

// TODO 上级条线主管单位信息(可能是多个)

// 如果是指定单位,直接根据流程定义ID放入map
OrgInfoDTO orgInfoDTO = new OrgInfoDTO();
orgInfoDTO.setOrgModelMap(orgModelsList.stream()


+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java Voir le fichier

@@ -122,7 +122,7 @@ public class PrequalificationDeclaredProjectManage {

//使用状态机 进入下一步 看看需不需要走省级审批
try {
stateMachineUtils.execute(projectInfo,stateMachineUtils.getProjectStatusPassEvent(projectInfo.getStatus()));
stateMachineUtils.pass(projectInfo);
} catch (Exception e) {
log.error("项目 调用状态机出错:",e);
throw new BusinessException(projectInfo.getId() + "项目 调用状态机出错 :" + e.getMessage());
@@ -155,7 +155,7 @@ public class PrequalificationDeclaredProjectManage {
params.setFormData(dto.getFormData());

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo);
instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("提交预审项目成功 【{}】", instanceId);

@@ -181,7 +181,7 @@ public class PrequalificationDeclaredProjectManage {
project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId);
//调用状态机 进入下一个通过状态
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
stateMachineUtils.pass(project);
projectService.updateById(project);

//保存项目和实例的关系


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java Voir le fichier

@@ -105,7 +105,7 @@ public class ReviewByDeptJointManage {
params.setFormData(formData);

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
log.info("部门联审申报成功 【{}】", instanceId);



+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java Voir le fichier

@@ -43,6 +43,7 @@ public class ReviewByProvincialDeptManage {
Boolean sucessProvince = Boolean.FALSE;
if(sucessProvince){
//成功了后

}

return Boolean.FALSE;


+ 0
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectDraftSaveDTO.java Voir le fichier

@@ -30,8 +30,4 @@ public class ProjectDraftSaveDTO implements Serializable {
@ApiModelProperty("项目信息")
private ProjectDTO projectInfo;

@NotNull
@ApiModelProperty("用户信息")
private ProcessInstanceUserDto user;

}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java Voir le fichier

@@ -269,12 +269,18 @@ public class ProjectDraft implements Serializable {
@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;

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

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

@ApiModelProperty("是否有主管部门 0没有 1有")
private Integer isSuperOrg;

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



+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java Voir le fichier

@@ -270,12 +270,18 @@ public class ProjectDraftVO implements Serializable {
@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;

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

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

@ApiModelProperty("是否有主管部门 0没有 1有")
private Integer isSuperOrg;

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



+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Voir le fichier

@@ -122,7 +122,7 @@ public class AnnualPlanLibManage {
});
projects.forEach(project -> {
try {
stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE);
stateMachine.pass(project);
} catch (Exception e) {
throw new BizException("开启方案申报失败");
}
@@ -133,7 +133,7 @@ public class AnnualPlanLibManage {
@Transactional(rollbackFor = Exception.class)
public void projectApproved(ProjectApprovedReq req) throws Exception {
Project project = projectService.getById(req.getProjectId());
stateMachine.execute(project, ProjectStatusChangeEvent.PROJECT_APPROVAL);
stateMachine.pass(project);
LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class)
.set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId())
@@ -147,7 +147,7 @@ public class AnnualPlanLibManage {
@Transactional(rollbackFor = Exception.class)
public void suspendAnnualPlan(ProjectIdReq req) throws Exception {
Project project = projectService.getById(req.getProjectId());
stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND);
stateMachine.reject(project);
projectService.updateById(project);
}



+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java Voir le fichier

@@ -252,12 +252,18 @@ public class ProjectDTO implements Serializable {
@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;

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

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

@ApiModelProperty("是否有主管部门 0没有 1有")
private Integer isSuperOrg;

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



+ 7
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Voir le fichier

@@ -267,12 +267,18 @@ public class Project implements Serializable {
@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("上级主管部门")
@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;

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

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

@ApiModelProperty("是否有主管部门 0没有 1有")
private Integer isSuperOrg;

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



+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java Voir le fichier

@@ -256,12 +256,18 @@ public class ProjectDetailVO {
@ApiModelProperty("批复金额")
private BigDecimal approvedTotalInvestmentIncrease;

@ApiModelProperty("是否有上级条线主管部门 0没有 1有")
private Integer isHigherSuperOrg;

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

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

@ApiModelProperty("是否有主管部门 0没有 1有")
private Integer isSuperOrg;

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



+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java Voir le fichier

@@ -47,7 +47,7 @@ public class ProjectStatusFlowTask {
//1. 定时取 项目暂存表的数据 去进行状态继续流转
List<ProjectStaging> stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class)
.eq(ProjectStaging::getDead,Boolean.FALSE)
.ge(ProjectStaging::getNextTime, LocalDateTime.now())
.le(ProjectStaging::getNextTime, LocalDateTime.now())
.le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES)
.orderByAsc(ProjectStaging::getProjectId));



+ 3
- 15
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Voir le fichier

@@ -422,12 +422,8 @@ public class TodoCenterManage {
* @since 2023/02/08
*/
private void updateRejectProjectStatus(Long userId, Project declaredProject) {
// 获取当前流程项目状态
Integer status = declaredProject.getStatus();
// 根据当前状态获取对应的通过事件
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusRejectEvent(status);
try {
stateMachineUtils.execute(declaredProject, event);
stateMachineUtils.reject(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
} catch (Exception e) {
@@ -483,12 +479,8 @@ public class TodoCenterManage {
* @since 2023/02/08
*/
private void updatePassProjectStatus(Long userId, Project declaredProject) {
// 获取当前流程项目状态
Integer status = declaredProject.getStatus();
// 根据当前状态获取对应的通过事件
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(status);
try {
stateMachineUtils.execute(declaredProject, event);
stateMachineUtils.pass(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
} catch (Exception e) {
@@ -574,12 +566,8 @@ public class TodoCenterManage {
* @since 2023/02/08
*/
private void updateWithdrawProjectStatus(Long userId, Project declaredProject) {
// 获取当前流程项目状态
Integer projectStatusSecond = declaredProject.getStatus();
// 根据当前状态获取对应的撤回事件
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusWithdrawEvent(projectStatusSecond);
try {
stateMachineUtils.execute(declaredProject, event);
stateMachineUtils.withDraw(declaredProject);
declaredProject.setUpdateOn(LocalDateTime.now());
declaredProject.setUpdateBy(userId);
} catch (Exception e) {


+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java Voir le fichier

@@ -27,7 +27,7 @@ public class StateMachineTest extends AppTests {
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode());
project.setDeclareAmount(BigDecimal.valueOf(2000));
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
stateMachineUtils.pass(project);
System.out.println(String.format("project:%s", JSON.toJSONString(project)));
}
}

+ 1
- 1
pmapi/src/test/java/com/ningdatech/pmapi/sys/project/ProjectStateTest.java Voir le fichier

@@ -38,7 +38,7 @@ public class ProjectStateTest extends AppTests {
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
//调用状态机 进入下一个通过状态
stateMachineUtils.execute(project,stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
stateMachineUtils.pass(project);

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


Chargement…
Annuler
Enregistrer