@@ -131,6 +131,8 @@ public class DeclaredProjectManage { | |||||
projectInfo.setId(null); | projectInfo.setId(null); | ||||
} | } | ||||
// defaultDeclaredProjectManage.startProcess(projectInfo,user,ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
String regionCode = user.getRegionCode(); | String regionCode = user.getRegionCode(); | ||||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | ||||
@@ -163,13 +165,14 @@ public class DeclaredProjectManage { | |||||
log.info("申报项目成功 【{}】", instanceId); | 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()); | projectDraftService.removeById(projectInfo.getDraftId()); | ||||
} | } | ||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | |||||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | ||||
return instanceId; | return instanceId; | ||||
@@ -249,7 +252,7 @@ public class DeclaredProjectManage { | |||||
* @param projectDto | * @param projectDto | ||||
* @param instanceId | * @param instanceId | ||||
*/ | */ | ||||
private Boolean saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||||
private Project saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | String employeeCode) { | ||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | ||||
try { | try { | ||||
@@ -288,11 +291,11 @@ public class DeclaredProjectManage { | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | projectInst.setUpdateOn(LocalDateTime.now()); | ||||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | ||||
projectInstService.save(projectInst); | projectInstService.save(projectInst); | ||||
return project; | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
log.error("项目信息入库错误 " + e); | log.error("项目信息入库错误 " + e); | ||||
throw new BusinessException("项目信息入库错误 :" + e); | throw new BusinessException("项目信息入库错误 :" + e); | ||||
} | } | ||||
return Boolean.TRUE; | |||||
} | } | ||||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | ||||
@@ -3,11 +3,12 @@ package com.ningdatech.pmapi.projectdeclared.manage; | |||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.alibaba.fastjson.TypeReference; | import com.alibaba.fastjson.TypeReference; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Maps; | |||||
import com.ningdatech.basic.function.VUtils; | 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.constant.RegionConst; | ||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | 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.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | 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.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.bean.entity.WflowModels; | |||||
import com.wflow.bean.entity.WflowOrgModels; | import com.wflow.bean.entity.WflowOrgModels; | ||||
import com.wflow.enums.OrgTypeEnum; | import com.wflow.enums.OrgTypeEnum; | ||||
import com.wflow.enums.ProcessDefTypeEnum; | import com.wflow.enums.ProcessDefTypeEnum; | ||||
import com.wflow.exception.BusinessException; | |||||
import com.wflow.service.OrgProcdefService; | import com.wflow.service.OrgProcdefService; | ||||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | import com.wflow.workflow.bean.dto.OrgInfoDTO; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | ||||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | ||||
import com.wflow.workflow.service.ProcessModelService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
@@ -48,11 +52,40 @@ public class DefaultDeclaredProjectManage { | |||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IDingOrganizationService dingOrganizationService; | |||||
private final ProcessModelService processModelService; | |||||
private final OrgProcdefService orgProcdefService; | private final OrgProcdefService orgProcdefService; | ||||
private final IDeclaredStatisticsService statisticsService; | 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){ | public void checkDuplication(ProjectDTO project){ | ||||
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | ||||
@@ -31,15 +31,15 @@ public class GenerateProjectCodeUtil { | |||||
@Autowired | @Autowired | ||||
private IProjectService projectService; | private IProjectService projectService; | ||||
public String generateProjectCode(ProjectDTO projectInfo){ | |||||
public String generateProjectCode(ProjectDTO project){ | |||||
// 获取所属行政区划代码(6位) | // 获取所属行政区划代码(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位固定 | // 9-12位固定 | ||||
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; | String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; | ||||
// 获取公司的财政编码 | // 获取公司的财政编码 | ||||
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(projectInfo.getBuildOrgCode()); | |||||
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode()); | |||||
// 从表中查出单位配置的财政编码 | // 从表中查出单位配置的财政编码 | ||||
if (Objects.isNull(companyFiscalCode)){ | if (Objects.isNull(companyFiscalCode)){ | ||||
@@ -51,8 +51,8 @@ public class GenerateProjectCodeUtil { | |||||
String projectIdStr; | String projectIdStr; | ||||
// 获取项目库当前最大项目序号 | // 获取项目库当前最大项目序号 | ||||
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId)); | 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){ | if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ | ||||
// 超过999的项目号从1开始 1 | // 超过999的项目号从1开始 1 | ||||
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; | Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; | ||||