Browse Source

优化申报代码结构

tags/24080901
PoffyZhang 1 year ago
parent
commit
a924c48074
7 changed files with 56 additions and 35 deletions
  1. +4
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java
  2. +2
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  3. +4
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  4. +35
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  5. +3
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  6. +2
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
  7. +6
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java

+ 4
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java View File

@@ -26,8 +26,11 @@ public interface DeclaredProjectContant {
public static final Integer YEAR_THREE = 2;
public static final Integer YEAR_FOUR = 4;

public static final Integer YEAR_DRAW_SURPLUS = 100;

public static final String FIXED_NUMBER = "0130";
public static final Long PROJECT_ID = 999L;
public static final Long MAX_PROJECT_ID = 999L;

public static final Long MIN_PROJECT_ID = 1L;
}
}

+ 2
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -129,13 +129,8 @@ public class ConstructionPlanManage {
params.setUser(declaredProjectManage.buildUser(employeeCode));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
dto.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(dto.getFormData());
//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params,dto);
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);


+ 4
- 8
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -228,14 +228,10 @@ public class DeclaredProjectManage {
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto);
dto.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(dto.getFormData());

//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params,dto);

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Project project = new Project();
BeanUtils.copyProperties(projectInfo,project);


+ 35
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java View File

@@ -1,10 +1,14 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO;
import com.ningdatech.pmapi.projectdeclared.service.IDeclaredStatisticsService;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
@@ -18,8 +22,10 @@ import com.wflow.enums.ProcessDefTypeEnum;
import com.wflow.service.OrgProcdefService;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.*;
@@ -174,4 +180,33 @@ public class DefaultDeclaredProjectManage {
//查此人建设单位的项目
return statisticsService.getRegionStatistics(user.getRegionCode(),year);
}

/**
* 把条件值放入工作流 用于判断条件 根据dto
* @param params
* @param dto
*/
public void buildCondition(ProcessStartParamsVo params, DefaultDeclaredDTO dto) {
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto);
dto.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(dto.getFormData());
}

/**
* 把条件值放入工作流 用于判断条件 根据d项目实体
* @param params
* @param projectInfo
*/
public void buildCondition(ProcessStartParamsVo params, Project projectInfo) {
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
}));
}
}

+ 3
- 5
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java View File

@@ -168,11 +168,9 @@ public class PrequalificationDeclaredProjectManage {
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
}));

//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params,projectInfo);

String regionCode = projectInfo.getAreaCode();



+ 2
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java View File

@@ -90,13 +90,8 @@ public class ReviewByDeptJointManage {

Map<String, Object> formData = Maps.newHashMap();
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectInfo, conditionDto);
formData.putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(formData);
//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params,projectInfo);

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project);


+ 6
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

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

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.StrPool;
@@ -34,9 +35,7 @@ public class GenerateProjectCodeUtil {
// 获取所属行政区划代码(6位)
String areaCode = projectInfo.getAreaCode();
// 获取建设年度后两位
Integer projectYear = projectInfo.getProjectYear();
String year = String.valueOf(projectYear)
.substring(DeclaredProjectContant.Project.YEAR_THREE, DeclaredProjectContant.Project.YEAR_FOUR);
String year = String.valueOf(projectInfo.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
@@ -52,11 +51,11 @@ public class GenerateProjectCodeUtil {
String projectIdStr;
// 获取项目库当前最大项目序号
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId));
Project project = projectList.get(0);
Long projectId = project.getId();
if (projectId > DeclaredProjectContant.Project.PROJECT_ID){
Project project = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(project) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : project.getId();
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){
// 超过999的项目号从1开始 1
Long newProjectId = projectId - DeclaredProjectContant.Project.PROJECT_ID;
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID;
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId);
}else {
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId);


Loading…
Cancel
Save