|
@@ -1,12 +1,29 @@ |
|
|
package com.ningdatech.pmapi.gov.utils; |
|
|
package com.ningdatech.pmapi.gov.utils; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.github.xiaoymin.knife4j.core.util.CommonUtils; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
import com.ningdatech.basic.util.StrPool; |
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
|
|
|
import com.ningdatech.pmapi.gov.enumeration.GovProjectClassifiedEnum; |
|
|
|
|
|
import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; |
|
|
import com.ningdatech.pmapi.gov.model.vo.*; |
|
|
import com.ningdatech.pmapi.gov.model.vo.*; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; |
|
|
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; |
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Classname ProjectCollectionUtil |
|
|
* @Classname ProjectCollectionUtil |
|
@@ -14,14 +31,19 @@ import java.util.Objects; |
|
|
* @Date 2023/9/14 9:07 |
|
|
* @Date 2023/9/14 9:07 |
|
|
* @Author PoffyZhang |
|
|
* @Author PoffyZhang |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
|
|
|
@Component |
|
|
|
|
|
@RequiredArgsConstructor |
|
|
public class ProjectConvertUtil { |
|
|
public class ProjectConvertUtil { |
|
|
|
|
|
|
|
|
|
|
|
private final GovProjectCollectionManage collectionManage; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 申报项目 转为 项目归集 |
|
|
* 申报项目 转为 项目归集 |
|
|
* @param project |
|
|
* @param project |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public static GovBizProjectDetailVO declaredToCollection(Project project){ |
|
|
|
|
|
|
|
|
public GovBizProjectDetailVO declaredToCollection(ProjectDetailVO project){ |
|
|
GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); |
|
|
GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); |
|
|
if(Objects.isNull(project)){ |
|
|
if(Objects.isNull(project)){ |
|
|
return projectCollection; |
|
|
return projectCollection; |
|
@@ -40,7 +62,7 @@ public class ProjectConvertUtil { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化基本信息 |
|
|
//转化基本信息 |
|
|
private static GovBizProjectBaseinfoVO buildBaseinfo(Project project) { |
|
|
|
|
|
|
|
|
private GovBizProjectBaseinfoVO buildBaseinfo(ProjectDetailVO project) { |
|
|
GovBizProjectBaseinfoVO baseinfo = new GovBizProjectBaseinfoVO(); |
|
|
GovBizProjectBaseinfoVO baseinfo = new GovBizProjectBaseinfoVO(); |
|
|
baseinfo.setBaseProjId(project.getProjectCode()); |
|
|
baseinfo.setBaseProjId(project.getProjectCode()); |
|
|
baseinfo.setBaseProjName(project.getProjectName()); |
|
|
baseinfo.setBaseProjName(project.getProjectName()); |
|
@@ -56,40 +78,99 @@ public class ProjectConvertUtil { |
|
|
baseinfo.setBaseManDepartUsci(project.getSuperOrgCreditCode()); |
|
|
baseinfo.setBaseManDepartUsci(project.getSuperOrgCreditCode()); |
|
|
baseinfo.setBaseProjContacts(project.getContactName()); |
|
|
baseinfo.setBaseProjContacts(project.getContactName()); |
|
|
baseinfo.setBaseProjContactsCall(project.getContactPhone()); |
|
|
baseinfo.setBaseProjContactsCall(project.getContactPhone()); |
|
|
// baseinfo.setBaseProjIsConfidentiality(CommonEnum.NO.getCode()); |
|
|
|
|
|
|
|
|
baseinfo.setBaseProjIsConfidentiality(GovProjectClassifiedEnum.NOT_CLASSIFIED.getCode()); |
|
|
|
|
|
baseinfo.setBaseProjPrincipal(project.getResponsibleMan()); |
|
|
|
|
|
baseinfo.setBaseProjPrincipalCall(project.getResponsibleManMobile()); |
|
|
|
|
|
baseinfo.setBaseProvManDeprt(project.getHigherSuperOrg()); |
|
|
|
|
|
baseinfo.setBaseProvManDepartDing(project.getHigherSuperOrgCode()); |
|
|
|
|
|
baseinfo.setBaseProvManDeprtType(project.getBaseProvManDeprtType()); |
|
|
|
|
|
// TODO 缺少状态映射 |
|
|
|
|
|
// baseinfo.setBaseProjSetProg(); |
|
|
|
|
|
baseinfo.setBaseProjType(project.getProjectType()); |
|
|
return baseinfo; |
|
|
return baseinfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化申报信息 |
|
|
//转化申报信息 |
|
|
private static GovBizProjectApplyVO buildApply(Project project) { |
|
|
|
|
|
|
|
|
private GovBizProjectApplyVO buildApply(ProjectDetailVO project) { |
|
|
GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); |
|
|
GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); |
|
|
|
|
|
|
|
|
|
|
|
apply.setBaseProjId(project.getProjectCode()); |
|
|
|
|
|
apply.setBaseProjName(project.getProjectName()); |
|
|
|
|
|
apply.setAreaCode(RegionConst.RC_LS); |
|
|
|
|
|
apply.setBaseHistorProjId(project.getBaseHistorProjId()); |
|
|
|
|
|
apply.setBaseBasisEstablish(project.getBaseBasisEstablish()); |
|
|
|
|
|
List<ProjectApplicationVO> projectApplications = project.getProjectApplications(); |
|
|
|
|
|
if(CollUtil.isNotEmpty(projectApplications)){ |
|
|
|
|
|
String appName = projectApplications.stream().map(app -> { |
|
|
|
|
|
if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { |
|
|
|
|
|
return app.getRelatedExistsApplication(); |
|
|
|
|
|
} |
|
|
|
|
|
return app.getApplicationName(); |
|
|
|
|
|
}).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); |
|
|
|
|
|
apply.setBaseAccountAppName(appName); |
|
|
|
|
|
} |
|
|
|
|
|
apply.setBaseBasisAmountOri(project.getBaseBasisAmountOri()); |
|
|
|
|
|
String coreBusiness = project.getCoreBusiness(); |
|
|
|
|
|
if(StringUtils.isNotBlank(coreBusiness)){ |
|
|
|
|
|
try{ |
|
|
|
|
|
JSONArray coreJson = JSON.parseArray(coreBusiness); |
|
|
|
|
|
String matters = coreJson.stream().map(j -> { |
|
|
|
|
|
JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
|
|
return matterJson.getString("matterName"); |
|
|
|
|
|
}).filter(Objects::nonNull) |
|
|
|
|
|
.collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); |
|
|
|
|
|
String matterCodes = coreJson.stream().map(j -> { |
|
|
|
|
|
JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
|
|
return matterJson.getString("oid"); |
|
|
|
|
|
}).filter(Objects::nonNull) |
|
|
|
|
|
.collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); |
|
|
|
|
|
apply.setBaseCoreBusiness(matters); |
|
|
|
|
|
apply.setBaseCoreBusinessCode(matterCodes); |
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
log.error("项目转化失败",e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
apply.setBaseDevelopCode(project.getDevelopCode()); |
|
|
|
|
|
apply.setBaseLowestLevel(project.getLowestLevel()); |
|
|
|
|
|
apply.setBaseHistorProjName(project.getBaseHistorProjName()); |
|
|
|
|
|
apply.setBaseHistorProjYear(project.getBaseHistorProjYear()); |
|
|
|
|
|
apply.setBaseProjApplyFile(project.getProjectApplicationForm()); |
|
|
|
|
|
apply.setBaseProjApplyFilePdf(collectionManage.convertAndUpload(project |
|
|
|
|
|
.getProjectApplicationForm()).toString()); |
|
|
|
|
|
String beginTime = project.getBeginTime(); |
|
|
|
|
|
String endTime = project.getEndTime(); |
|
|
|
|
|
if(StringUtils.isNotBlank(beginTime)){ |
|
|
|
|
|
apply.setBaseProjStartTime(BizUtils.convertLocalDateTime(beginTime)); |
|
|
|
|
|
} |
|
|
|
|
|
if(StringUtils.isNotBlank(endTime)){ |
|
|
|
|
|
apply.setBaseProjEndTime(BizUtils.convertLocalDateTime(endTime)); |
|
|
|
|
|
} |
|
|
|
|
|
apply.setBaseProjDuration(project.getBuildCycle()); |
|
|
return apply; |
|
|
return apply; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化审批信息 |
|
|
//转化审批信息 |
|
|
private static GovBizProjectApproveVO buildApprove(Project project) { |
|
|
|
|
|
|
|
|
private GovBizProjectApproveVO buildApprove(ProjectDetailVO project) { |
|
|
GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); |
|
|
GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); |
|
|
|
|
|
|
|
|
return approve; |
|
|
return approve; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化建设 实施 |
|
|
//转化建设 实施 |
|
|
private static GovBizProjectCimplementVO buildCim(Project project) { |
|
|
|
|
|
|
|
|
private GovBizProjectCimplementVO buildCim(ProjectDetailVO project) { |
|
|
GovBizProjectCimplementVO cim = new GovBizProjectCimplementVO(); |
|
|
GovBizProjectCimplementVO cim = new GovBizProjectCimplementVO(); |
|
|
|
|
|
|
|
|
return cim; |
|
|
return cim; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化运维实施 |
|
|
//转化运维实施 |
|
|
private static GovBizProjectMimplementVO buildMim(Project project) { |
|
|
|
|
|
|
|
|
private GovBizProjectMimplementVO buildMim(ProjectDetailVO project) { |
|
|
GovBizProjectMimplementVO mim = new GovBizProjectMimplementVO(); |
|
|
GovBizProjectMimplementVO mim = new GovBizProjectMimplementVO(); |
|
|
|
|
|
|
|
|
return mim; |
|
|
return mim; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//转化采购信息 |
|
|
//转化采购信息 |
|
|
private static List<GovBizProjectProcureVO> buildProcure(Project project) { |
|
|
|
|
|
|
|
|
private List<GovBizProjectProcureVO> buildProcure(ProjectDetailVO project) { |
|
|
List<GovBizProjectProcureVO> procures = Lists.newArrayList(); |
|
|
List<GovBizProjectProcureVO> procures = Lists.newArrayList(); |
|
|
|
|
|
|
|
|
return procures; |
|
|
return procures; |
|
|