diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 21331af..96a0064 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -211,7 +211,12 @@ public class ProjectLibManage { */ public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, String employeeCode, Project oldProject) { - // 将旧的项目状态置为,版本置为不是最新 + + Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject); + Long newProjectId = project.getId(); + + // 将旧的项目状态、阶段置为null,版本置为不是最新,项目编号设置为新的项目编号 + oldProject.setProjectCode(project.getProjectCode()); oldProject.setNewest(Boolean.FALSE); projectService.updateById(oldProject); @@ -220,9 +225,7 @@ public class ProjectLibManage { .set(Project::getStatus,null) .eq(Project::getId,oldProject.getId()); projectService.update(updateWrapper); - - Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject); - Long newProjectId = project.getId(); + // 关联旧的项目的审核实例到新的项目ID List allVersionProjectIds = projectService.getAllVersionProjectId(project); List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) @@ -655,7 +658,7 @@ public class ProjectLibManage { * @since 2023/02/11 11:15 */ public ProjectDetailVO getProjectDetail(Long projectId) { - // 查询建设方案申报前最新的项目申报信息 + // 查询最新的项目申报信息 Project projectInfo = projectService.getNewProject(projectId); if (Objects.isNull(projectInfo)) { return null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index a9f014d..f7dfd23 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -369,4 +369,13 @@ public class Project implements Serializable { @ApiModelProperty("初步方案项目ID") private Long prePlanProjectId; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核意见") + private String countrySealAuditOpinion; + + @ApiModelProperty("区县预审上级条线主管单位盖章审核日期") + private String countrySealAuditDate; + + @ApiModelProperty("区县预审盖章上级条线主管单位印章编号") + private String countrySealNo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index 5f53f0b..40f6d7a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -376,6 +376,9 @@ public class ProjectDetailVO { @ApiModelProperty("版本号str") private String versionStr; + @ApiModelProperty("初步方案项目ID") + private Long prePlanProjectId; + public String getVersionStr() { if (Objects.nonNull(this.newest) && this.newest) { this.versionStr = "当前版本"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java index defaee8..8cb42c8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterConstant.java @@ -24,5 +24,11 @@ public interface TodoCenterConstant { public static final String CITY_TEMPLATE = "市级-预审申请单"; public static final String COUNTRY_TEMPLATE = "区县-预审申请单"; public static final String CONSTRUCT_TEMPLATE = "建设方案申请单"; + + public static final String COUNTRY_SEAL_POS_PAGE = "7"; + public static final Float COUNTRY_SEAL_POS_X = 483F; + public static final Float COUNTRY_SEAL_POS_Y = 619F; + public static final Integer COUNTRY_SEAL_SIGN_TYPE = 1; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index ea21adb..1144d31 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.todocenter.model.vo.NotSealedInfoVO; import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -171,9 +172,9 @@ public class TodoCenterController { @ApiOperation("获取未签章的pdf文件") @WebLog("获取未签章的pdf文件") - @PostMapping("/getNotSealedPdf/{projectId}") - public Long getNotSealedPdf (@Valid @PathVariable("projectId") Long projectId){ - return todoCenterManage.getNotSealedPdf(projectId); + @PostMapping("/getNotSealedPdf") + public NotSealedInfoVO getNotSealedPdf (@Valid @RequestBody SealInfoDTO req){ + return todoCenterManage.getNotSealedPdf(req); } @ApiOperation("获取签章后的pdf文件") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 53388c9..e33de79 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -23,6 +23,7 @@ import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.handle.PassHandle; import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle; import com.ningdatech.pmapi.todocenter.model.dto.*; +import com.ningdatech.pmapi.todocenter.model.vo.*; import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.wflow.contants.HisProInsEndActId; @@ -40,7 +41,6 @@ import org.flowable.engine.HistoryService; import org.flowable.engine.RepositoryService; import org.flowable.engine.TaskService; import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.task.Comment; import org.flowable.task.api.Task; import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.variable.api.history.HistoricVariableInstance; @@ -85,9 +85,6 @@ import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; -import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; -import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; import com.ningdatech.pmapi.todocenter.service.StatisticsService; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.ningdatech.pmapi.todocenter.utils.PdfUtils; @@ -455,17 +452,14 @@ public class TodoCenterManage { * @param req * @param declaredProject * @param templateName - * @param paramsMap + * @param notSealedFileId * @return void * @author CMM * @since 2023/03/16 21:34 */ - private Long getSealedPdf(SealInfoDTO req, Project declaredProject, String templateName, JSONObject paramsMap) { - Long projectId = req.getProjectId(); - // 再次获取装配了盖章意见和盖章日期参数的未盖章pdf文件 - Long pretrialFileId = generateNotSealedPdf(projectId, templateName, paramsMap); + private Long generateSealedPdf(SealInfoDTO req, Project declaredProject, String templateName, Long notSealedFileId) { // 获取预审申请单文件,并转换为Base64 - File pdfFile = fileService.getById(pretrialFileId); + File pdfFile = fileService.getById(notSealedFileId); InputStream fileInputStream = fileService.getFileInputStream(pdfFile); String pdfEncode64 = Base64.encode(fileInputStream); // 装配盖章接口请求参数信息 @@ -477,13 +471,19 @@ public class TodoCenterManage { Float posY = req.getPosY(); signReq.setPosX(posX); signReq.setPosY(posY); - // 获取当前登录签章用户信息 - Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取印章编号 - CompanySignature companySignature = companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, userFullInfo.getEmpPosUnitCode())); - String sealSn = companySignature.getSealSn(); + String sealSn; + if (Objects.isNull(req.getSealSn())) { + // 获取当前登录签章用户信息 + Long userId = LoginUserUtil.getUserId(); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取印章编号 + CompanySignature companySignature = companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, userFullInfo.getEmpPosUnitCode())); + sealSn = companySignature.getSealSn(); + }else { + // 区县预审时,对有上级条线主管单位并进行了盖章的情况,需要根据上次的印章编号再次盖章 + sealSn = req.getSealSn(); + } signReq.setSealSn(sealSn); String posPage = req.getPosPage(); signReq.setPosPage(posPage); @@ -1098,14 +1098,21 @@ public class TodoCenterManage { /** * 获取未盖章的预审申请单/建设方案申请单pdf文件 - * @param projectId + * @param req * @return java.lang.Long * @author CMM * @since 2023/03/16 22:46 */ - public Long getNotSealedPdf(Long projectId) { + public NotSealedInfoVO getNotSealedPdf(SealInfoDTO req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + String empPosUnitCode = user.getEmpPosUnitCode(); + Long projectId = req.getProjectId(); + String auditOpinion = req.getAuditOpinion(); + String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + NotSealedInfoVO notSealedInfoVo = new NotSealedInfoVO(); // 判断项目盖章审批类型 Project project = projectService.getById(projectId); + String buildOrgCode = project.getBuildOrgCode(); String instanceId = project.getInstCode(); ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .eq(ProjectInst::getInstCode, instanceId)); @@ -1115,37 +1122,119 @@ public class TodoCenterManage { // 再根据项目所属区域判断是市级预审还是区县预审 String areaCode = project.getAreaCode(); Long pretrialFileId = project.getPretrialFileId(); - // 如果项目关联的预审文件ID不为空,说明已经进行过盖章审核,直接返回盖章后的预审申请单文件ID + // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID if (Objects.nonNull(pretrialFileId)){ - return pretrialFileId; + notSealedInfoVo.setFileId(pretrialFileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return notSealedInfoVo; } Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) .eq(Region::getRegionCode, areaCode)); - if (Objects.isNull(region)){ - throw new BizException("项目所属区域不存在!"); - } + VUtils.isTrue(Objects.isNull(region)).throwMessage("项目所属区域不存在!"); Integer regionLevel = region.getRegionLevel(); + // 获取项目申报时是否选择了主管单位和上级条线主管单位 + // 主管单位信息 + Integer isSuperOrg = project.getIsSuperOrg(); + String superOrgCode = project.getSuperOrgCode(); + // 上级条线主管单位信息 + Integer isHigherSuperOrg = project.getIsHigherSuperOrg(); + String higherSuperOrgCode = project.getHigherSuperOrgCode(); switch (regionLevel) { // 市级预审 case RegionConst.RL_CITY: String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; // 设置pdf模板参数 JSONObject cityParamsMap = assemblyPdfParams(project,cityTemplateName); - // 本级主管单位意见 - cityParamsMap.put("superOrgOpinion",null); - cityParamsMap.put("superOrgAuditDate",null); - return generateNotSealedPdf(projectId,cityTemplateName, cityParamsMap); + // 盖章审核为主管单位审核 + if (CommonEnum.YES.getCode().equals(isSuperOrg)){ + // 有主管单位信息且登录用户所在单位是主管单位 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, cityParamsMap); + } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, cityParamsMap); + } + Long cityPdfId = generateNotSealedPdf(projectId, cityTemplateName, cityParamsMap); + notSealedInfoVo.setFileId(cityPdfId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return notSealedInfoVo; // 区县预审 case RegionConst.RL_COUNTY: String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; + String sealNo = null; + Long notSealedId = null; // 设置pdf模板参数 JSONObject countryParamsMap = assemblyPdfParams(project, countryTemplateName); - // 本级主管单位意见、上级主管单位意见 - countryParamsMap.put("superOrgOpinion",null); - countryParamsMap.put("superOrgAuditDate",null); - countryParamsMap.put("higherOrgOpinion",null); - countryParamsMap.put("higherOrgAuditDate",null); - return generateNotSealedPdf(projectId,countryTemplateName, countryParamsMap); + // 以是否有上级主管单位的维度判断(有上级条线主管单位,才有可能需要盖两次章) + if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) { + // 盖章审核登录用户所在单位为上级条线主管单位,此时为区县预审盖章流程第一个章 + if (empPosUnitCode.equals(higherSuperOrgCode)) { + // 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位, + countryParamsMap.put("higherOrgOpinion", auditOpinion); + countryParamsMap.put("higherOrgAuditDate", auditDate); + // 获取上级条线主管单位印章编号 + CompanySignature companySignature = + companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, higherSuperOrgCode)); + if (Objects.nonNull(companySignature)) { + sealNo = companySignature.getSealSn(); + } + // 保存区县预审上级条线主管单位盖章审核意见、审核日期和盖章编号 + project.setCountrySealNo(sealNo); + project.setCountrySealAuditOpinion(auditOpinion); + project.setCountrySealAuditDate(auditDate); + projectService.updateById(project); + countryParamsMap.put("superOrgOpinion", null); + countryParamsMap.put("superOrgAuditDate", null); + // 直接返回装填了上级条线主管单位意见的未盖章文件 + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + // 盖章审核登录用户所在单位不为上级条线主管单位(可能为选择的主管单位、项目建设单位、其他单位), + // 此时为区县预审盖章流程第二个章 + else if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 有上级条线主管单位信息且有本级主管单位信息 + // 有主管单位信息且登录用户所在单位是主管单位 + // 装配本级主管单位审核意见 + checkEmpPosUnitCode(empPosUnitCode,auditOpinion,auditDate,superOrgCode,countryParamsMap); + // 装配上级条线主管单位意见,调用盖章接口, + // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 + SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); + Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); + }else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 有上级条线主管单位信息,没有本级主管单位信息 + // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(empPosUnitCode,auditOpinion,auditDate,buildOrgCode,countryParamsMap); + // 装配上级条线主管单位意见,调用盖章接口, + // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 + SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); + Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); + } + } + // 没有上级主管条线单位 + else if (CommonEnum.NO.getCode().equals(isHigherSuperOrg)) { + // 有本级主管单位信息 + if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 登录用户所在单位是本级主管单位,装配本级主管单位审核意见 + checkEmpPosUnitCode(empPosUnitCode,auditOpinion,auditDate,superOrgCode,countryParamsMap); + // 直接返回装配了本级主管单位审核意见的未盖章文件 + countryParamsMap.put("higherOrgOpinion", null); + countryParamsMap.put("higherOrgAuditDate", null); + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + // 没有选主管单位,默认为项目建设单位 + else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(empPosUnitCode,auditOpinion,auditDate,buildOrgCode,countryParamsMap); + // 直接返回装配了项目建设单位审核意见的未盖章文件 + countryParamsMap.put("higherOrgOpinion", null); + countryParamsMap.put("higherOrgAuditDate", null); + notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); + } + } + notSealedInfoVo.setFileId(notSealedId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return notSealedInfoVo; default: throw new IllegalStateException("Unexpected value: " + regionLevel); } @@ -1153,19 +1242,50 @@ public class TodoCenterManage { // 如果为建设方案申报审批 else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)){ Long constructFileId = project.getConstructFileId(); - // 如果项目关联的建设方案文件ID不为空,说明已经进行过盖章审核,直接返回盖章后的建设方案申请单文件ID + // 如果项目关联的建设方案文件ID不为空,说明已经提交过审核意见,直接返回文件ID if (Objects.nonNull(constructFileId)){ - return constructFileId; + notSealedInfoVo.setFileId(constructFileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return notSealedInfoVo; } // 设置pdf模板参数 String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; - JSONObject countryParamsMap = assemblyPdfParams(project, constructTemplateName); - // 本级主管单位意见、上级主管单位意见 - countryParamsMap.put("bigDataBureauOpinion",null); - countryParamsMap.put("bigDataBureauAuditDate",null); - return generateNotSealedPdf(projectId,constructTemplateName, countryParamsMap); + JSONObject constructParamsMap = assemblyPdfParams(project, constructTemplateName); + // 审核为指定大数据局盖章 + // 获取流程配置的指定单位信息 + constructParamsMap.put("bigDataBureauOpinion",auditOpinion); + constructParamsMap.put("bigDataBureauAuditDate",auditDate); + Long constructNotFileId = generateNotSealedPdf(projectId, constructTemplateName, constructParamsMap); + notSealedInfoVo.setFileId(constructNotFileId); + notSealedInfoVo.setIsCommit(Boolean.TRUE); + return notSealedInfoVo; + } + return notSealedInfoVo; + } + + private SealInfoDTO getHigherSealInfoDTO(Project project, JSONObject countryParamsMap) { + String countrySealAuditOpinion = project.getCountrySealAuditOpinion(); + String countrySealAuditDate = project.getCountrySealAuditDate(); + countryParamsMap.put("higherOrgOpinion", countrySealAuditOpinion); + countryParamsMap.put("higherOrgAuditDate", countrySealAuditDate); + SealInfoDTO sealInfoDTO = new SealInfoDTO(); + sealInfoDTO.setPosPage(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_PAGE); + sealInfoDTO.setProjectId(project.getId()); + sealInfoDTO.setPosX(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_X); + sealInfoDTO.setPosY(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_Y); + sealInfoDTO.setSignType(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_SIGN_TYPE); + sealInfoDTO.setSealSn(project.getCountrySealNo()); + return sealInfoDTO; + } + + private void checkEmpPosUnitCode(String empPosUnitCode, String auditOpinion, String auditDate, String orgCode, JSONObject cityParamsMap) { + if (empPosUnitCode.equals(orgCode)) { + cityParamsMap.put("superOrgOpinion", auditOpinion); + cityParamsMap.put("superOrgAuditDate", auditDate); + }else { + cityParamsMap.put("superOrgOpinion", null); + cityParamsMap.put("superOrgAuditDate", null); } - return null; } private Long generateNotSealedPdf(Long projectId, String templateName, JSONObject paramsMap) { @@ -1186,14 +1306,26 @@ public class TodoCenterManage { MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); // 上传OSS - FileResultVO resultVO = fileService.upload(multipartFile, "default"); + FileResultVO resultVo = fileService.upload(multipartFile, "default"); - // 将返回的文件ID保存到项目库中 - Project project = projectService.getById(projectId); - project.setPretrialFileId(resultVO.getId()); - project.setPretrialFileName(resultVO.getOriginalFileName()); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); + // 将带审核意见的返回的文件ID更新到项目库中对应的项目下 + Project declaredProject = projectService.getById(projectId); + // 根据模版名称判断是预审申请单还是建设方案申请单 + String superOrgOpinion = paramsMap.getString("superOrgOpinion"); + String higherOrgOpinion = paramsMap.getString("higherOrgOpinion"); + if (StringUtils.isNotBlank(superOrgOpinion) || StringUtils.isNotBlank(higherOrgOpinion)) { + if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || + TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + declaredProject.setPretrialFileId(resultVo.getId()); + declaredProject.setPretrialFileName(resultVo.getOriginalFileName()); + declaredProject.setUpdateOn(LocalDateTime.now()); + } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + declaredProject.setConstructFileId(resultVo.getId()); + declaredProject.setConstructFileName(resultVo.getOriginalFileName()); + declaredProject.setUpdateOn(LocalDateTime.now()); + } + projectService.updateById(declaredProject); + } try { if (null != htmlInputStream) { htmlInputStream.close(); @@ -1210,7 +1342,7 @@ public class TodoCenterManage { } // 返回文件id供前端下载 - return resultVO.getId(); + return resultVo.getId(); } /** @@ -1340,14 +1472,10 @@ public class TodoCenterManage { } public Long getSealedPdf(SealInfoDTO req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = user.getEmpPosUnitCode(); + Long projectId = req.getProjectId(); - // 盖章审核意见 - String auditOpinion = req.getAuditOpinion(); - String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + Long notSealedFileId = req.getNotSealedFileId(); Project declaredProject = projectService.getById(projectId); - String buildOrgCode = declaredProject.getBuildOrgCode(); String instanceId = declaredProject.getInstCode(); ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .eq(ProjectInst::getInstCode, instanceId)); @@ -1362,61 +1490,15 @@ public class TodoCenterManage { throw new BizException("项目所属区域不存在!"); } Integer regionLevel = region.getRegionLevel(); - // 获取项目申报时是否选择了主管单位和上级条线主管单位 - // 主管单位信息 - Integer isSuperOrg = declaredProject.getIsSuperOrg(); - String superOrgCode = declaredProject.getSuperOrgCode(); - // 上级条线主管单位信息 - Integer isHigherSuperOrg = declaredProject.getIsHigherSuperOrg(); - String higherSuperOrgCode = declaredProject.getHigherSuperOrgCode(); switch (regionLevel) { // 市级预审 case RegionConst.RL_CITY: String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; - // 设置pdf模板参数 - JSONObject cityParamsMap = assemblyPdfParams(declaredProject, cityTemplateName); - // 盖章审核为主管单位审核 - if (CommonEnum.YES.getCode().equals(isSuperOrg)){ - // 有主管单位信息且登录用户所在单位是主管单位 - if (superOrgCode.equals(empPosUnitCode)){ - cityParamsMap.put("superOrgOpinion",auditOpinion); - cityParamsMap.put("superOrgAuditDate",auditDate); - } - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - if (buildOrgCode.equals(empPosUnitCode)) { - cityParamsMap.put("superOrgOpinion", auditOpinion); - cityParamsMap.put("superOrgAuditDate", auditDate); - } - } - return getSealedPdf(req, declaredProject,cityTemplateName,cityParamsMap); + return generateSealedPdf(req, declaredProject,cityTemplateName,notSealedFileId); // 区县预审 case RegionConst.RL_COUNTY: String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; - // 设置pdf模板参数 - JSONObject countryParamsMap = assemblyPdfParams(declaredProject, countryTemplateName); - - // 判断当前盖章用户所在单位是本级主管单位还是上级主管单位 - if (CommonEnum.YES.getCode().equals(isSuperOrg)){ - // 有主管单位信息且登录用户所在单位是主管单位 - if (superOrgCode.equals(empPosUnitCode)){ - countryParamsMap.put("superOrgOpinion",auditOpinion); - countryParamsMap.put("superOrgAuditDate",auditDate); - } - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - if (buildOrgCode.equals(empPosUnitCode)) { - countryParamsMap.put("superOrgOpinion", auditOpinion); - countryParamsMap.put("superOrgAuditDate", auditDate); - } - } else if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) { - // 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位 - if (higherSuperOrgCode.equals(empPosUnitCode)){ - countryParamsMap.put("higherOrgOpinion",auditOpinion); - countryParamsMap.put("higherOrgAuditDate",auditDate); - } - } - return getSealedPdf(req, declaredProject,countryTemplateName, countryParamsMap); + return generateSealedPdf(req, declaredProject,countryTemplateName, notSealedFileId); default: throw new IllegalStateException("Unexpected value: " + regionLevel); } @@ -1425,12 +1507,7 @@ public class TodoCenterManage { else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)){ // 设置pdf模板参数 String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; - JSONObject constructParamsMap = assemblyPdfParams(declaredProject, constructTemplateName); - // 审核为指定大数据局盖章 - // 获取流程配置的指定单位信息 - constructParamsMap.put("bigDataBureauOpinion",auditOpinion); - constructParamsMap.put("bigDataBureauAuditDate",auditDate); - return getSealedPdf(req, declaredProject,constructTemplateName, constructParamsMap); + return generateSealedPdf(req, declaredProject,constructTemplateName, notSealedFileId); } return null; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java index 185cc7d..26165be 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/SealInfoDTO.java @@ -35,7 +35,17 @@ public class SealInfoDTO { private Integer signType; /** + * 印章编号 + */ + private String sealSn; + + /** * 盖章审核意见 */ private String auditOpinion; + + /** + * 未盖章文件ID + */ + private Long notSealedFileId; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java new file mode 100644 index 0000000..2240e13 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/NotSealedInfoVO.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.todocenter.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取未盖章pdf文件接口返回信息 + * @return + * @author CMM + * @since 2023/07/15 16:53 + */ +@Data +public class NotSealedInfoVO { + + @ApiModelProperty("未盖章PDF文件ID") + private Long fileId; + + @ApiModelProperty("是否提交了审核意见") + private Boolean isCommit; + + +}