@@ -0,0 +1,113 @@ | |||
package com.ningdatech.pmapi.projectdeclared.converter; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | |||
import org.assertj.core.util.Lists; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname ApplicationConverter | |||
* @Description | |||
* @Date 2023/3/13 17:38 | |||
* @Author PoffyZhang | |||
*/ | |||
public class ApplicationConverter { | |||
public static ProvincialProjectDTO convertProject(Project projectInfo,List<ProjectApplication> applications) { | |||
return ProvincialProjectDTO.builder() | |||
.regionCode(projectInfo.getAreaCode()) | |||
.regionName(projectInfo.getArea()) | |||
.projectName(projectInfo.getProjectName()) | |||
.projectId(String.valueOf(projectInfo.getId())) | |||
.projectType(projectInfo.getProjectType()) | |||
.totalMoney(projectInfo.getDeclareAmount()) | |||
.yearBudget(projectInfo.getAnnualPlanAmount()) | |||
.budgetFrom(projectInfo.getDeclareHaveAmount() + "," + | |||
projectInfo.getDeclareGovOwnFinanceAmount() + "," | |||
+ projectInfo.getDeclareGovSuperiorFinanceAmount()) | |||
.year(String.valueOf(projectInfo.getProjectYear())) | |||
.financialCode(projectInfo.getFinancialCode()) | |||
.developCode(projectInfo.getDevelopCode()) | |||
.beginTime(projectInfo.getBeginTime()) | |||
.endTime(projectInfo.getEndTime()) | |||
.buildBasis("立项依据") | |||
.buildBasisFile(projectInfo.getBuildBasis()) | |||
.projectSummary(projectInfo.getProjectIntroduction()) | |||
.responsibleMan(projectInfo.getResponsibleMan()) | |||
.responsibleManPhone(projectInfo.getResponsibleManMobile()) | |||
.contactName(projectInfo.getContactName()) | |||
.contactPhone(projectInfo.getContactPhone()) | |||
.buildUnit(projectInfo.getBuildOrgName()) | |||
.buildUnitCode(projectInfo.getBuildOrgCode()) | |||
.superUnit(projectInfo.getSuperOrg()) | |||
.superUnitCode(projectInfo.getSuperOrgCode()) | |||
.projectApplyFile(projectInfo.getProjectPdf()) | |||
.projectEstimateFile(projectInfo.getCalculationTotalInvestmentFile()) | |||
.unitThreePlan(projectInfo.getMainResponsibilitiesApplicantFile()) | |||
.otherFile(projectInfo.getPreliminaryPlanFile()) | |||
.projectRemark(projectInfo.getProjectRemarks()) | |||
.includeApplication(projectInfo.getIncludeApplication()) | |||
.applicationInfo(convertApplications(applications)) | |||
.build(); | |||
} | |||
//放入项目 app | |||
private static List<ProvincialApplicationDTO> convertApplications(List<ProjectApplication> applications) { | |||
if(CollUtil.isEmpty(applications)){ | |||
Collections.emptyList(); | |||
} | |||
return applications.stream().map(ApplicationConverter::convertApp).collect(Collectors.toList()); | |||
} | |||
private static ProvincialApplicationDTO convertApp(ProjectApplication projectApplication) { | |||
return ProvincialApplicationDTO.builder() | |||
.clouds(convertCloud(projectApplication)) | |||
.isFirst(projectApplication.getIsFirst()) | |||
.applicationName(projectApplication.getApplicationName()) | |||
.applicationCode(projectApplication.getRelatedExistsApplicationCode()) | |||
.relatedExistsApplication(projectApplication.getRelatedExistsApplication()) | |||
.applicationType(2) | |||
.buildLevel(projectApplication.getBuildLevel()) | |||
.isUniteBuild(projectApplication.getIsUniteBuild()) | |||
.unionBuildKind(projectApplication.getUnionBuildKind()) | |||
.applicationSummary(projectApplication.getApplicationSummary()) | |||
.applicationRemark(projectApplication.getApplicationRemark()) | |||
.applicationEstimateFile(projectApplication.getApplicationEstimateFile()) | |||
.isFiveDomain(projectApplication.getIsDigitalModification()) | |||
.fiveDomain(projectApplication.getDigitalModification()) | |||
.bizDomain(projectApplication.getBizDomain()) | |||
.isBizCooperate(projectApplication.getIsBizCooperate()) | |||
.userRange(projectApplication.getUsesRangeRemark()) | |||
.useGovCloud(projectApplication.getUseGovCloud()) | |||
.nationalITSpec(projectApplication.getNationalItSpec()) | |||
.netEnv(String.valueOf(projectApplication.getNetEnv())) | |||
.secrecyGrade(projectApplication.getSecrecyGrade()) | |||
.passwordGrade(projectApplication.getPasswordGrade()) | |||
.accountAppName(projectApplication.getAccountAppName()) | |||
.brainAccountAppName(projectApplication.getDomainBrainAccount()) | |||
.useCommonData(projectApplication.getUseCommonData()) | |||
.dataName(projectApplication.getDataName()) | |||
.commonComponents(projectApplication.getCommonComponents()) | |||
.useCommonComponent(projectApplication.getUseCommonComponent()) | |||
.isProduceCommonComponent(projectApplication.getProduceCommonComponent()) | |||
.produceCommonComponent(projectApplication.getProduceCommonComponents()) | |||
.publishSide(projectApplication.getPublishSide()) | |||
.build(); | |||
} | |||
private static List<ProvincialApplicationDTO.Cloud> convertCloud(ProjectApplication projectApplication) { | |||
return Lists.newArrayList(ProvincialApplicationDTO.Cloud.builder() | |||
.cloudType(projectApplication.getCloudsType()) | |||
.cloudNums(projectApplication.getCloudsNumber()) | |||
.cloudBasicSpec(projectApplication.getCloudsFoundationSpecifications()) | |||
.cloudUseDescription(projectApplication.getCloudsDescription()) | |||
.build()); | |||
} | |||
} |
@@ -64,6 +64,7 @@ import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -375,19 +376,15 @@ public class DeclaredProjectManage { | |||
} | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||
Long userId = userInfoDetails.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
//放入用户的单位 | |||
param.setBuildOrgCode(userFullInfo.getOrganizationCode()); | |||
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | |||
param.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
Page<Project> page = projectService.page(param.page(), query); | |||
List<Project> records = page.getRecords(); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<DeclaredProjectExportDTO> collect = records.stream().map(r -> { | |||
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
@@ -395,11 +392,9 @@ public class DeclaredProjectManage { | |||
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
exportDTO.setCreateOn(createOnStr); | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
return exportDTO; | |||
}).collect(Collectors.toList()); | |||
for (int i = 0; i < collect.size(); i++) { | |||
collect.get(i).setSerialNumber(i + 1); | |||
} | |||
String fileName = "项目申报列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
//数据导出处理函数 | |||
@@ -43,6 +43,7 @@ import java.time.LocalDateTime; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
@@ -163,13 +164,9 @@ public class ProjectAdjustmentManage { | |||
req.setBuildOrgCode(userFullInfo.getOrganizationCode()); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | |||
req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | |||
List<Project> records = page.getRecords(); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
List<ProjectAdjustmentExportDTO> collect = records.stream().map(r -> { | |||
ProjectAdjustmentExportDTO exportDTO = new ProjectAdjustmentExportDTO(); | |||
BeanUtils.copyProperties(r, exportDTO); | |||
@@ -177,11 +174,9 @@ public class ProjectAdjustmentManage { | |||
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
exportDTO.setCreateOn(createOnStr); | |||
exportDTO.setSerialNumber(serialNumber.incrementAndGet()); | |||
return exportDTO; | |||
}).collect(Collectors.toList()); | |||
for (int i = 0; i < collect.size(); i++) { | |||
collect.get(i).setSerialNumber(i + 1); | |||
} | |||
String fileName = "项目内容调整列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
//数据导出处理函数 | |||
@@ -1,18 +1,30 @@ | |||
package com.ningdatech.pmapi.projectdeclared.manage; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | |||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname ReviewByProvincialDeptManage | |||
@@ -31,6 +43,10 @@ public class ReviewByProvincialDeptManage { | |||
private final DefaultDeclaredProjectManage defaultProjectManage; | |||
private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
private final IProjectApplicationService applicationService; | |||
/** | |||
* 省级部门联审 | |||
* @param project | |||
@@ -47,17 +63,21 @@ public class ReviewByProvincialDeptManage { | |||
VUtils.isTrue(!ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals(projectInfo.getStatus()) || | |||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) | |||
.throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); | |||
// TODO 对接省级联审的接口 | |||
Boolean sucessProvince = Boolean.TRUE; | |||
if(sucessProvince){ | |||
//测试先成功 | |||
stateMachineUtils.pass(project); | |||
projectService.updateById(project); | |||
//直接去预审 | |||
if(StringUtils.isNotBlank(defaultProjectManage | |||
.directStartProcess(project,project.getPreStartUserId()))){ | |||
return Boolean.TRUE; | |||
} | |||
// 对接省级联审的接口 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, projectInfo.getId())); | |||
if(joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(projectInfo,applications))){ | |||
return Boolean.TRUE; | |||
// //测试先成功 | |||
// stateMachineUtils.pass(project); | |||
// projectService.updateById(project); | |||
// //直接去预审 | |||
// if(StringUtils.isNotBlank(defaultProjectManage | |||
// .directStartProcess(project,project.getPreStartUserId()))){ | |||
// return Boolean.TRUE; | |||
// } | |||
} | |||
return Boolean.FALSE; | |||
@@ -67,7 +67,7 @@ public class ProjectApplication implements Serializable { | |||
@ApiModelProperty("是否数改系统 0:否 1:是") | |||
private Integer isDigitalModification; | |||
@ApiModelProperty("数改系统") | |||
@ApiModelProperty("数改系统 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' 多个用英文,分隔") | |||
private String digitalModification; | |||
@ApiModelProperty("业务领域") | |||
@@ -1,5 +1,7 @@ | |||
package com.ningdatech.pmapi.provincial.controller; | |||
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | |||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | |||
import io.swagger.annotations.Api; | |||
@@ -24,14 +26,19 @@ public class TestController { | |||
@Autowired | |||
private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
@PostMapping("/push") | |||
@Autowired | |||
private ReviewByProvincialDeptManage provincialDeptManage; | |||
@GetMapping("/push") | |||
@ApiOperation("测试推送") | |||
private String push(@Valid @RequestBody ProvincialProjectDTO project){ | |||
return joinReviewProvincialBureauService.pushImportProject(project); | |||
private Boolean push(@Valid @RequestParam Long projectId){ | |||
Project project = new Project(); | |||
project.setId(projectId); | |||
return provincialDeptManage.startTheProcess(project); | |||
} | |||
@GetMapping("/detail") | |||
@ApiOperation("测试推送") | |||
@ApiOperation("测试获取详情") | |||
private String detail(@RequestParam String projectId){ | |||
return joinReviewProvincialBureauService.processInfo(projectId); | |||
} | |||
@@ -1,11 +1,13 @@ | |||
package com.ningdatech.pmapi.provincial.model.dto; | |||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
@@ -17,7 +19,9 @@ import java.util.List; | |||
@Data | |||
@Builder | |||
@ApiModel(value = "ProvincialApplicationDTO", description = "") | |||
public class ProvincialApplicationDTO { | |||
public class ProvincialApplicationDTO implements Serializable { | |||
//云 信息 | |||
private List<Cloud> clouds; | |||
//是否初次建设 1是 2不是 | |||
@@ -85,7 +89,9 @@ public class ProvincialApplicationDTO { | |||
//发布端 '浙里办','浙政钉','数字化改革门户','支付宝','微信','网页','PC客户端','APP端' | |||
private String publishSide; | |||
public static class Cloud { | |||
@Builder | |||
@JsonIgnoreProperties(value = { "handler"}) | |||
public static class Cloud implements Serializable { | |||
//云资源台数 11 | |||
private Integer cloudNums; | |||
//云资源类型 云服务器(ECS) | |||
@@ -7,6 +7,7 @@ import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
@@ -21,7 +22,7 @@ import java.util.List; | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
@ApiModel(value = "ProvincialProjectDTO", description = "") | |||
public class ProvincialProjectDTO { | |||
public class ProvincialProjectDTO implements Serializable { | |||
@ApiModelProperty("区域code") | |||
private String regionCode; | |||
@@ -114,10 +115,10 @@ public class ProvincialProjectDTO { | |||
private String projectRemark; | |||
@ApiModelProperty("是否有效 1有效 2无效 3撤回") | |||
private String isEffective; | |||
private Integer isEffective; | |||
@ApiModelProperty("是否包含应用 1包含") | |||
private String includeApplication; | |||
private Integer includeApplication; | |||
@ApiModelProperty("app信息") | |||
private List<ProvincialApplicationDTO> applicationInfo; | |||
@@ -14,7 +14,7 @@ public interface IJoinReviewProvincialBureauService { | |||
* 推送/保存 重大接口到 省局联审 | |||
* @return | |||
*/ | |||
String pushImportProject(ProvincialProjectDTO project); | |||
Boolean pushImportProject(ProvincialProjectDTO project); | |||
/** | |||
@@ -2,6 +2,8 @@ package com.ningdatech.pmapi.provincial.service.impl; | |||
import cn.hutool.core.util.StrUtil; | |||
import cn.hutool.crypto.SecureUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import com.ningdatech.pmapi.common.config.ProvincialProperties; | |||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | |||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | |||
@@ -35,12 +37,12 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
* @return | |||
*/ | |||
@Override | |||
public String pushImportProject(ProvincialProjectDTO project){ | |||
public Boolean pushImportProject(ProvincialProjectDTO project){ | |||
Long timeStamp = System.currentTimeMillis()/1000; | |||
String url = provincialProperties.getHost() + provincialProperties.getPushUrl() | |||
+ "?timestamp=" + timeStamp; | |||
log.info("省局推送联审url {}",url); | |||
ResponseEntity<String> responseEntity = null; | |||
ResponseEntity<ApiResponse> responseEntity = null; | |||
String signature = getSha256(timeStamp,provincialProperties.getPushUrl(), | |||
HttpMethod.POST.name()); | |||
@@ -55,14 +57,19 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
.accept(MediaType.APPLICATION_JSON) | |||
.body(project); | |||
log.info("省局联审 提交 :{}", requestEntity); | |||
log.info("省局联审 提交body :{}", JSON.toJSONString(requestEntity.getBody())); | |||
try { | |||
responseEntity = restTemplate.exchange(requestEntity,String.class); | |||
responseEntity = restTemplate.exchange(requestEntity, ApiResponse.class); | |||
log.info("省局联审 响应 :{}",responseEntity); | |||
if(responseEntity.getBody().getCode().equals(200)){ | |||
return Boolean.TRUE; | |||
} | |||
} catch (Exception e) { | |||
log.error("[省局联审] http request error", e); | |||
} | |||
return responseEntity.getBody(); | |||
return Boolean.FALSE; | |||
} | |||
/** | |||