Bladeren bron

Merge remote-tracking branch 'origin/master'

master
WendyYang 1 jaar geleden
bovenliggende
commit
7d58aede69
3 gewijzigde bestanden met toevoegingen van 49 en 13 verwijderingen
  1. +7
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  2. +36
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  3. +6
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java

+ 7
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java Bestand weergeven

@@ -131,6 +131,8 @@ public class DeclaredProjectManage {
projectInfo.setId(null);
}

// defaultDeclaredProjectManage.startProcess(projectInfo,user,ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode());

String regionCode = user.getRegionCode();

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
@@ -163,13 +165,14 @@ public class DeclaredProjectManage {
log.info("申报项目成功 【{}】", instanceId);

//如果是重新提交的话 判断下 项目是否存在
if(saveOrUpdateProject(projectInfo, instanceId,employeeCode) && Objects.nonNull(projectInfo.getDraftId())){
Project buildProject = saveOrUpdateProject(projectInfo, instanceId,employeeCode);
if(Objects.nonNull(projectInfo.getDraftId())){
//如果是草稿箱提交 删除对应的草稿箱
projectDraftService.removeById(projectInfo.getDraftId());
}

//发送给第一个审批人消息
noticeManage.sendFirtUser(project,model.getFormName(),instanceId,
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId,
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);

return instanceId;
@@ -249,7 +252,7 @@ public class DeclaredProjectManage {
* @param projectDto
* @param instanceId
*/
private Boolean saveOrUpdateProject(ProjectDTO projectDto, String instanceId,
private Project saveOrUpdateProject(ProjectDTO projectDto, String instanceId,
String employeeCode) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
@@ -288,11 +291,11 @@ public class DeclaredProjectManage {
projectInst.setUpdateOn(LocalDateTime.now());
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
return project;
} catch (Exception e) {
log.error("项目信息入库错误 " + e);
throw new BusinessException("项目信息入库错误 :" + e);
}
return Boolean.TRUE;
}

public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) {


+ 36
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java Bestand weergeven

@@ -3,11 +3,12 @@ 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.google.common.collect.Maps;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
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;
@@ -17,13 +18,16 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.bean.entity.WflowOrgModels;
import com.wflow.enums.OrgTypeEnum;
import com.wflow.enums.ProcessDefTypeEnum;
import com.wflow.exception.BusinessException;
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 com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -48,11 +52,40 @@ public class DefaultDeclaredProjectManage {

private final UserInfoHelper userInfoHelper;

private final IDingOrganizationService dingOrganizationService;
private final ProcessModelService processModelService;
private final OrgProcdefService orgProcdefService;

private final IDeclaredStatisticsService statisticsService;

/**
* 公共的发起流程方法
*/
public void startProcess(ProjectDTO projectDTO,UserFullInfoDTO user,Integer processType){
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, user.getRegionCode())
.eq(WflowModels::getProcessType, processType)
.last(BizConst.LIMIT_1));

if (Objects.isNull(model)) {
log.error("此 【{}】区域找不到对应流程配置", user.getRegionCode());
throw new BusinessException(String.format("此 【%s】区域找不到对应流程配置", user.getRegionCode()));
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(buildUser(user.getEmployeeCode()));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(projectDTO, conditionDto);
Map<String,Object> formData = Maps.newHashMap();
formData.putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(formData);

}

//项目名称去重
public void checkDuplication(ProjectDTO project){
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class)


+ 6
- 6
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java Bestand weergeven

@@ -31,15 +31,15 @@ public class GenerateProjectCodeUtil {
@Autowired
private IProjectService projectService;

public String generateProjectCode(ProjectDTO projectInfo){
public String generateProjectCode(ProjectDTO project){
// 获取所属行政区划代码(6位)
String areaCode = projectInfo.getAreaCode();
String areaCode = project.getAreaCode();
// 获取建设年度后两位
String year = String.valueOf(projectInfo.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(projectInfo.getBuildOrgCode());
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode());

// 从表中查出单位配置的财政编码
if (Objects.isNull(companyFiscalCode)){
@@ -51,8 +51,8 @@ public class GenerateProjectCodeUtil {
String projectIdStr;
// 获取项目库当前最大项目序号
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId));
Project project = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(project) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : project.getId() + 1;
Project maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0);
Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1;
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){
// 超过999的项目号从1开始 1
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID;


Laden…
Annuleren
Opslaan