diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java index 2fc2ab3..40289c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java @@ -1,19 +1,17 @@ package com.ningdatech.pmapi.irs.controller; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ningdatech.log.annotation.WebLog; import com.ningdatech.pmapi.irs.manage.AppIrsManage; import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; -import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; + import javax.validation.Valid; import java.security.NoSuchAlgorithmException; -import java.util.List; /** * @Classname ApplicationController @@ -45,4 +43,10 @@ public class ApplicationController { public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { return appIrsManage.searchApps(apply); } + + @GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}") + public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) { + return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java index 02856c4..6b92eed 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java @@ -1,9 +1,6 @@ package com.ningdatech.pmapi.irs.controller; import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil; import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; @@ -11,10 +8,11 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.client.RestTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java index 82d43f2..6120d4c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java @@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.ningdatech.irs.service.IRefreshTokenService; import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.CryptUtils; import com.ningdatech.pmapi.common.util.HttpUtil; import com.ningdatech.pmapi.common.util.RefreshKeyUtil; -import com.ningdatech.pmapi.irs.model.dto.*; +import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; +import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; +import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; import com.ningdatech.pmapi.irs.model.res.ApiResponse; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; @@ -34,7 +35,6 @@ import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; import java.security.NoSuchAlgorithmException; import java.time.LocalDateTime; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -93,8 +93,23 @@ public class AppIrsManage { @Value("${irs.push-project-detail.appSecret}") private String pushProjectAppSecret; + //=============数字资源指标获取======================================================================================== + + @Value("${irs.digital-resource-indicators.app-key}") + private String driAppKey; + + @Value("${irs.digital-resource-indicators.app-secret}") + private String driAppSecret; + + @Value("${irs.digital-resource-indicators.interface-name}") + private String driInterfaceName; + + @Value("${irs.digital-resource-indicators.url}") + private String driUrl; + /** * 推送 项目和应用关系 + * * @param dto * @return * @throws NoSuchAlgorithmException @@ -112,14 +127,14 @@ public class AppIrsManage { ApiApplyDTO apiApply = new ApiApplyDTO(); apiApply.setAppId(appCode); JSONObject jsonObject = this.searchApp(apiApply); - ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class); + ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class); VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); long timestamp = System.currentTimeMillis(); String areaCode = project.getAreaCode(); String projectName = project.getProjectName(); String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret); - String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b"); + String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); String capTime = String.valueOf(timestamp); String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); String url = pushUrl + "?requestTime=" + timestamp + @@ -134,14 +149,14 @@ public class AppIrsManage { ApiResponse body = forEntity.getBody(); - if(Objects.isNull(body) || Objects.isNull(body.getCode()) - || 0 != body.getCode()){ + if (Objects.isNull(body) || Objects.isNull(body.getCode()) + || 0 != body.getCode()) { return Boolean.FALSE; } //保存关系 app.setAppCode(appCode); - if(applicationService.updateById(app)){ + if (applicationService.updateById(app)) { /** * 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 * 如果都已经注册 要调用状态机 进入下一个状态 @@ -150,8 +165,8 @@ public class AppIrsManage { .eq(ProjectApplication::getProjectId, project.getId())); //筛选出 初次新建的app 但是没有appCode的 apps = apps.stream().filter(a -> { - if(CommonEnum.YES.getCode().equals(a.getIsFirst()) && - StringUtils.isBlank(app.getAppCode())){ + if (CommonEnum.YES.getCode().equals(a.getIsFirst()) && + StringUtils.isBlank(app.getAppCode())) { return Boolean.TRUE; } return Boolean.FALSE; @@ -159,7 +174,7 @@ public class AppIrsManage { .collect(Collectors.toList()); //如果筛选出来的 为空的话 就调用状态机 - if(CollUtil.isEmpty(apps)){ + if (CollUtil.isEmpty(apps)) { stateMachineUtils.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); @@ -171,6 +186,7 @@ public class AppIrsManage { /** * 查询app + * * @param apply * @return * @throws NoSuchAlgorithmException @@ -184,27 +200,27 @@ public class AppIrsManage { "&appKey=" + searchAppKey + "&" + "pageSize=10&pageNum=1&appCode=" + appCode + "&areaCode=&deptCode=&name="; - log.info("url : {}",url); + log.info("url : {}", url); RestTemplate restTemplate = new RestTemplate(); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); + log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); - if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())){ + if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) { JSONObject body = JSON.parseObject(forEntity.getBody()); - if(Objects.isNull(body)){ + if (Objects.isNull(body)) { return null; } JSONObject datas = body.getJSONObject("datas"); - if(Objects.isNull(datas)){ + if (Objects.isNull(datas)) { return null; } JSONObject data = datas.getJSONObject("data"); - if(Objects.isNull(data)){ + if (Objects.isNull(data)) { return null; } JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); - if(CollUtil.isEmpty(apiApplySearchResult)){ + if (CollUtil.isEmpty(apiApplySearchResult)) { return null; } return apiApplySearchResult.getJSONObject(0); @@ -225,19 +241,19 @@ public class AppIrsManage { RestTemplate restTemplate = new RestTemplate(); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); + log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); - if(Objects.nonNull(forEntity.getBody())){ + if (Objects.nonNull(forEntity.getBody())) { JSONObject body = JSON.parseObject(forEntity.getBody()); - if(Objects.isNull(body)){ + if (Objects.isNull(body)) { return null; } JSONObject datas = body.getJSONObject("datas"); - if(Objects.isNull(datas)){ + if (Objects.isNull(datas)) { return null; } JSONObject data = datas.getJSONObject("data"); - if(Objects.isNull(data)){ + if (Objects.isNull(data)) { return null; } JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); @@ -252,14 +268,14 @@ public class AppIrsManage { String appKey = "A331101453557202109017383"; String method = "POST"; String interfaceName = "5crv7i4727abLCv0"; - String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); - log.info("secret :{}",secret); + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); + log.info("secret :{}", secret); String sign = MD5.create().digestHex(appKey + secret + timestamp); HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); RestTemplate restTemplate; - if(Objects.nonNull(factory)){ + if (Objects.nonNull(factory)) { restTemplate = new RestTemplate(factory); - }else{ + } else { restTemplate = new RestTemplate(); } String appId = "A330000100000202105005790"; @@ -269,7 +285,7 @@ public class AppIrsManage { "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + timestamp + "&appId=" + appId; - log.info("url :{}",url); + log.info("url :{}", url); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); log.info(forEntity.getBody()); return forEntity.getBody(); @@ -277,6 +293,7 @@ public class AppIrsManage { /** * 推送项目详情 + * * @return */ public String pushProjectDetail(ProjectDTO projectDto) { @@ -285,14 +302,14 @@ public class AppIrsManage { String appKey = pushProjectAppKey; String method = HttpMethod.POST.name(); String interfaceName = pushProjectInterfaceName; - String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); - log.info("secret :{}",secret); + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); + log.info("secret :{}", secret); String sign = MD5.create().digestHex(appKey + secret + timestamp); HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); RestTemplate restTemplate; - if(Objects.nonNull(factory)){ + if (Objects.nonNull(factory)) { restTemplate = new RestTemplate(factory); - }else{ + } else { restTemplate = new RestTemplate(); } String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" @@ -318,13 +335,13 @@ public class AppIrsManage { String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; String capCode = null; - try{ + try { capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); - }catch (Exception e){ + } catch (Exception e) { log.error(e.getMessage()); } - String url = pushProjectUrl+ "?" + + String url = pushProjectUrl + "?" + "requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + "&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + @@ -337,9 +354,36 @@ public class AppIrsManage { "&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + "&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + "&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; - log.info("url :{}",url); + log.info("url :{}", url); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); log.info(forEntity.getBody()); return forEntity.getBody(); } + + public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) { + long timestamp = System.currentTimeMillis(); + String appSecret = driAppSecret; + String appKey = driAppKey; + String method = HttpMethod.POST.name(); + String interfaceName = driInterfaceName; + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); + log.info("secret : {}", secret); + String sign = MD5.create().digestHex(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if (Objects.nonNull(factory)) { + restTemplate = new RestTemplate(factory); + } else { + restTemplate = new RestTemplate(); + } + + String url = driUrl + "?" + + "requestTime=" + timestamp + "&sign=" + sign + + "&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize; + log.info("url :{}", url); + ResponseEntity forEntity = restTemplate.getForEntity(url, JSONObject.class); + log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString()); + return forEntity.getBody(); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java index d2e15d5..5fa6eb9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java @@ -238,7 +238,8 @@ public class FinalAcceptanceManage { //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); //发送给第一个审批人消息 noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, @@ -298,7 +299,8 @@ public class FinalAcceptanceManage { //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); //发送给第一个审批人消息 noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java index c318a54..577c0c5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java @@ -102,9 +102,6 @@ public class ReviewByDeptJointManage { //保存项目信息 projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); -// if(!modifyProject(projectInfo, instanceId)){ -// return Boolean.FALSE; -// } //发送给第一个审批人消息 noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java index 7aca628..5b040fd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java @@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -64,6 +65,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); ProcessProgressVo instanceDetail = null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java index 5ecc257..a93b73e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java @@ -10,6 +10,7 @@ import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -66,6 +67,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); if (Objects.isNull(projectInst)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java index c4a1843..e23cb42 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java @@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -60,10 +61,13 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { if (Objects.isNull(project)){ throw new BizException("当前项目不存在!"); } + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(projectId); // 根据项目ID查询项目预审流程的流程状态 ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, projectId) + .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last("limit 1")); ProcessProgressVo instanceDetail = null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java index 659b22d..0eef546 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java @@ -13,6 +13,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -60,6 +61,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java index 14b592b..776f5ca 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java @@ -20,6 +20,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.process.ProgressNode; @@ -67,6 +68,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) + .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); ProcessProgressVo instanceDetail = null; 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 559ab06..cd7651f 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 @@ -317,6 +317,7 @@ public class ProjectLibManage { project.setVersion(oldProject.getVersion() + 1); // 标记为建设方案申报 project.setIsConstruct(Boolean.TRUE); + project.setIsBackReject(Boolean.FALSE); // 保存初步方案项目ID if (Boolean.TRUE.equals(oldProject.getIsConstruct())) { // 重新提交 @@ -384,9 +385,13 @@ public class ProjectLibManage { project.setId(null); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); + project.setIsBackReject(Boolean.FALSE); stateMachineUtils.pass(project); projectService.save(project); + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + projectService.update(Wrappers.lambdaUpdate(Project.class) .set(Project::getNewest, Boolean.FALSE) .ne(Project::getId, project.getId()) @@ -410,6 +415,8 @@ public class ProjectLibManage { project.setId(null); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); + //都是在驳回 重新提交时用的 + project.setIsBackReject(Boolean.FALSE); if (Objects.nonNull(stageCode)) { project.setStage(stageCode); } @@ -417,6 +424,9 @@ public class ProjectLibManage { project.setStatus(statusCode); } + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + if (projectService.save(project)) { projectService.update(Wrappers.lambdaUpdate(Project.class) .set(Project::getNewest, Boolean.FALSE) @@ -500,7 +510,7 @@ public class ProjectLibManage { return project; } - public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { + public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType,Boolean isBackReject) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); @@ -512,9 +522,13 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); // 标识保存的项目信息是否为建设方案申报项目 - project.setIsConstruct(Boolean.TRUE); + project.setIsConstruct(Boolean.FALSE); + project.setIsBackReject(isBackReject); stateMachineUtils.pass(project); + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); @@ -549,9 +563,12 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); // 标识保存的项目信息是否为建设方案申报项目 - project.setIsConstruct(Boolean.TRUE); + project.setIsConstruct(Boolean.FALSE); stateMachineUtils.pass(project); + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + if (projectService.save(project)) { //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); @@ -1020,8 +1037,11 @@ public class ProjectLibManage { return res; } + //只查 当前版本 和历史被驳回|退回的版本 List historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getProjectCode, project.getProjectCode()) + .and(q1->q1.eq(Project::getNewest, Boolean.TRUE) + .or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE))) .orderByDesc(Project::getCreateOn)); if (CollUtil.isEmpty(historyProjects)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java index 8c38403..06edaf1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java @@ -317,4 +317,7 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("项目类型 01首次建设;02迭代升级;03结转建设;04新运维;05续运维") private String baseProjType; + + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject = Boolean.FALSE; } 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 6856b51..fcb7571 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 @@ -483,4 +483,8 @@ public class Project implements Serializable { @ApiModelProperty("区县预审本级主管单位盖章审核日期") private String countrySealAuditDate; + + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject; + } 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 21ded6a..edaab44 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 @@ -395,6 +395,9 @@ public class ProjectDetailVO { @ApiModelProperty("审批详情") private ProcessProgressDetailVo process; + @ApiModelProperty("是否退回|驳回的项目版本") + private Boolean isBackReject; + public String getVersionStr() { if (Objects.nonNull(this.newest) && this.newest) { this.versionStr = "当前版本"; 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 25c3b0f..9b91443 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 @@ -653,10 +653,7 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream() - .filter(p -> Objects.nonNull(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) - .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -796,10 +793,7 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream() - .filter(p -> Objects.nonNull(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) - .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -1108,12 +1102,15 @@ public class TodoCenterManage { project.setUpdateOn(LocalDateTime.now()); projectService.save(project); + oldProject.setIsBackReject(Boolean.TRUE); + projectService.updateById(oldProject); + ProjectInst oldInst = projectInstService.getOne(Wrappers.lambdaUpdate(ProjectInst.class) .eq(ProjectInst::getProjectId, oldProject.getId()) .eq(ProjectInst::getInstCode, oldProject.getInstCode())); String instCode = oldProject.getInstCode(); - oldInst.setInstCode("EMPTY"); + oldInst.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); projectInstService.updateById(oldInst); ProjectInst newPi = new ProjectInst(); @@ -1142,6 +1139,9 @@ public class TodoCenterManage { .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); if (CollUtil.isNotEmpty(applicationList)) { projectApplicationService.removeBatchByIds(applicationList); + List applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList()); +// projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) +// .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); } List applications = projectDto.getApplicationList(); @@ -1159,11 +1159,19 @@ public class TodoCenterManage { !InstTypeEnum.DEPT_UNITED_REVIEW.getCode().equals(instType)) { projectApplication.setIsConstruct(Boolean.TRUE); } - if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ - projectApplication.setApplicationName(null); - } projectApplication.setProjectVersion(project.getVersion()); - projectApplicationService.save(projectApplication); + boolean result = projectApplicationService.save(projectApplication); +// // 保存应用关联的核心业务 +// List coreBusinessList = application.getCoreBusinessList(); +// Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; +// if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ +// for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { +// ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); +// BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); +// projectCoreBusinessIndicators.setApplicationId(application.getId()); +// projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); +// } +// } } } return Boolean.TRUE; diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index be8920d..12506d8 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -206,6 +206,11 @@ provincial: #天印服务器接口信息 irs: is-search-app: false + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interface-name: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 seal-platform: project-id: 330001110 project-secret: 70e512d40c8f440484db4acab181570a diff --git a/pmapi/src/main/resources/application-pre.yml b/pmapi/src/main/resources/application-pre.yml index 359614b..27b951d 100644 --- a/pmapi/src/main/resources/application-pre.yml +++ b/pmapi/src/main/resources/application-pre.yml @@ -209,6 +209,11 @@ provincial: #天印服务器接口信息 irs: is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 seal-platform: project-id: 330001110 project-secret: 70e512d40c8f440484db4acab181570a diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 2f1baa9..23da4c4 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -209,6 +209,11 @@ provincial: #天印服务器接口信息 irs: is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 seal-platform: project-id: 330001110 project-secret: 70e512d40c8f440484db4acab181570a diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java index e0c0d1c..b5a4d53 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java @@ -7,6 +7,7 @@ import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.common.util.CryptUtils; import com.ningdatech.pmapi.common.util.HmacAuthUtil; import com.ningdatech.pmapi.common.util.RefreshKeyUtil; +import com.ningdatech.pmapi.irs.manage.AppIrsManage; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddAuthClient; import com.ningdatech.zwdd.client.ZwddClient; @@ -20,12 +21,14 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; + import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.security.NoSuchAlgorithmException; -import java.util.*; +import java.util.Map; +import java.util.Objects; /** * @Classname IrsTest @@ -40,9 +43,11 @@ public class IrsTest extends AppTests { @Autowired private ZwddClient zwddClient; + @Autowired + private AppIrsManage appIrsManage; @Test - public void test1(){ + public void test1() { String method = "GET"; String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + "?appCode=A331101453557202109017383"; @@ -53,14 +58,14 @@ public class IrsTest extends AppTests { //请求头 HttpHeaders headers = new HttpHeaders(); - for(Map.Entry entry : header.entrySet()){ + for (Map.Entry entry : header.entrySet()) { headers.add(entry.getKey(), entry.getValue()); } //封装请求头 HttpEntity> formEntity = new HttpEntity>(headers); RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class); + ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class); System.out.println(JSON.toJSONString(forEntity)); } @@ -100,7 +105,7 @@ public class IrsTest extends AppTests { String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + - "&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId + + "&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId + "&isEffective=1&baseProjSysCode=" + baseProjSysCode; RestTemplate restTemplate = new RestTemplate(); ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); @@ -116,7 +121,7 @@ public class IrsTest extends AppTests { } @Test - public void test4(){ + public void test4() { CloseableHttpResponse response = null; try { String api = "/media/download"; @@ -147,7 +152,7 @@ public class IrsTest extends AppTests { fos.close(); } catch (Exception e) { System.out.println(e); - }finally { + } finally { if (response != null) { try { //特别提醒:需要调用response的close方法关闭网络连接!!! @@ -160,7 +165,7 @@ public class IrsTest extends AppTests { } @Test - public void test5(){ + public void test5() { CloseableHttpResponse response = null; try { String api = "/media/download"; @@ -191,7 +196,7 @@ public class IrsTest extends AppTests { fos.close(); } catch (Exception e) { System.out.println(e); - }finally { + } finally { if (response != null) { try { //特别提醒:需要调用response的close方法关闭网络连接!!! @@ -206,6 +211,7 @@ public class IrsTest extends AppTests { private static ExecutableClient zwddExecutableClient; @Autowired private ZwddIntegrationProperties zwddProperties; + public ExecutableClient getZwddExecutableClient() { if (Objects.isNull(zwddExecutableClient)) { synchronized (ZwddAuthClientProvider.class) { @@ -224,4 +230,5 @@ public class IrsTest extends AppTests { } return zwddExecutableClient; } + } diff --git a/pmapi/src/test/resources/application-dev.yml b/pmapi/src/test/resources/application-dev.yml index be8920d..1576bb9 100644 --- a/pmapi/src/test/resources/application-dev.yml +++ b/pmapi/src/test/resources/application-dev.yml @@ -206,6 +206,11 @@ provincial: #天印服务器接口信息 irs: is-search-app: false + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 seal-platform: project-id: 330001110 project-secret: 70e512d40c8f440484db4acab181570a diff --git a/pmapi/src/test/resources/application-pre.yml b/pmapi/src/test/resources/application-pre.yml index 359614b..9f449f4 100644 --- a/pmapi/src/test/resources/application-pre.yml +++ b/pmapi/src/test/resources/application-pre.yml @@ -145,7 +145,7 @@ flowable: async-executor-activate: true #关闭一些不需要的功能服务 rest-api-enabled: false -# database-schema-update: false + # database-schema-update: false idm: enabled: false common: @@ -209,6 +209,11 @@ provincial: #天印服务器接口信息 irs: is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 seal-platform: project-id: 330001110 project-secret: 70e512d40c8f440484db4acab181570a