|
|
@@ -4,12 +4,13 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.ningdatech.basic.util.StrPool; |
|
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
|
import com.ningdatech.pmapi.gov.enumeration.GovProjectClassifiedEnum; |
|
|
|
import com.ningdatech.pmapi.gov.model.vo.*; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; |
|
|
@@ -17,6 +18,7 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
@@ -101,7 +103,7 @@ public class ProjectConvertUtil { |
|
|
|
//转化申报信息 |
|
|
|
private static GovBizProjectApplyVO buildApply(ProjectDetailVO project) { |
|
|
|
GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); |
|
|
|
apply.setBaseProjId(project.getProjectCode()); |
|
|
|
// apply.setBaseProjId(project.getProjectCode()); |
|
|
|
apply.setBaseProjName(project.getProjectName()); |
|
|
|
apply.setAreaCode(RegionConst.RC_LS); |
|
|
|
apply.setBaseHistorProjId(project.getBaseHistorProjId()); |
|
|
@@ -183,7 +185,7 @@ public class ProjectConvertUtil { |
|
|
|
//转化审批信息 |
|
|
|
private static GovBizProjectApproveVO buildApprove(ProjectDetailVO project) { |
|
|
|
GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); |
|
|
|
approve.setBaseProjId(project.getProjectCode()); |
|
|
|
// approve.setBaseProjId(project.getProjectCode()); |
|
|
|
approve.setBaseProjName(project.getProjectName()); |
|
|
|
approve.setApprovalFile(project.getApprovedFile()); |
|
|
|
approve.setAreaCode(RegionConst.RC_LS); |
|
|
@@ -224,23 +226,128 @@ public class ProjectConvertUtil { |
|
|
|
|
|
|
|
//转化建设 实施 |
|
|
|
private static GovBizProjectCimplementVO buildCim(ProjectDetailVO project) { |
|
|
|
|
|
|
|
GovBizProjectCimplementVO cim = new GovBizProjectCimplementVO(); |
|
|
|
|
|
|
|
// cim.setBaseProjId(project.getProjectCode()); |
|
|
|
cim.setBaseProjName(project.getProjectName()); |
|
|
|
cim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); |
|
|
|
cim.setAreaCode(RegionConst.RC_LS); |
|
|
|
cim.setDeleted(Boolean.FALSE); |
|
|
|
cim.setBaseDevelopCode(project.getDevelopCode()); |
|
|
|
//总结报告 |
|
|
|
cim.setBaseSummReportFile(searchReportFile(project,5,2)); |
|
|
|
//监理总结报告 |
|
|
|
cim.setBaseEstaSummFile(searchReportFile(project,5,3)); |
|
|
|
//建设核查表 |
|
|
|
cim.setBaseCheckFile(searchReportFile(project,3,2)); |
|
|
|
cim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); |
|
|
|
cim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); |
|
|
|
List<ProjectApplicationVO> projectApplications = project.getProjectApplications(); |
|
|
|
if(CollUtil.isNotEmpty(projectApplications)){ |
|
|
|
String appCode = projectApplications.stream().map(app -> { |
|
|
|
if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { |
|
|
|
return app.getRelatedExistsApplicationCode(); |
|
|
|
} |
|
|
|
return app.getAppCode(); |
|
|
|
}).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); |
|
|
|
cim.setBaseProjSysCode(appCode); |
|
|
|
} |
|
|
|
return cim; |
|
|
|
} |
|
|
|
|
|
|
|
//转化运维实施 |
|
|
|
private static GovBizProjectMimplementVO buildMim(ProjectDetailVO project) { |
|
|
|
GovBizProjectMimplementVO mim = new GovBizProjectMimplementVO(); |
|
|
|
|
|
|
|
// mim.setBaseProjId(project.getProjectCode()); |
|
|
|
mim.setBaseProjName(project.getProjectName()); |
|
|
|
mim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); |
|
|
|
mim.setAreaCode(RegionConst.RC_LS); |
|
|
|
mim.setDeleted(Boolean.FALSE); |
|
|
|
mim.setBaseDevelopCode(project.getDevelopCode()); |
|
|
|
//监理总结报告 |
|
|
|
mim.setBaseEstaSummFile(searchReportFile(project,5,3)); |
|
|
|
//建设核查表 |
|
|
|
// mim.setBaseCheckFile(searchReportFile(project,3,2)); |
|
|
|
mim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); |
|
|
|
// mim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); |
|
|
|
List<ProjectApplicationVO> projectApplications = project.getProjectApplications(); |
|
|
|
if(CollUtil.isNotEmpty(projectApplications)){ |
|
|
|
String appCode = projectApplications.stream().map(app -> { |
|
|
|
if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { |
|
|
|
return app.getRelatedExistsApplicationCode(); |
|
|
|
} |
|
|
|
return app.getAppCode(); |
|
|
|
}).collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); |
|
|
|
mim.setBaseProjSysCode(appCode); |
|
|
|
} |
|
|
|
return mim; |
|
|
|
} |
|
|
|
|
|
|
|
//转化采购信息 |
|
|
|
private static List<GovBizProjectProcureVO> buildProcure(ProjectDetailVO project) { |
|
|
|
List<GovBizProjectProcureVO> procures = Lists.newArrayList(); |
|
|
|
|
|
|
|
return procures; |
|
|
|
List<PurchaseVO> purchases = project.getPurchases(); |
|
|
|
ContractVO contract = project.getContract(); |
|
|
|
final BigDecimal[] paymentTotal = {BigDecimal.ZERO}; |
|
|
|
if(Objects.nonNull(contract)){ |
|
|
|
List<PaymentPlanVO> payments = contract.getPayments(); |
|
|
|
payments.stream().map(PaymentPlanVO::getPaymentAmount) |
|
|
|
.reduce(BigDecimal::add) |
|
|
|
.ifPresent(b -> paymentTotal[0] = b); |
|
|
|
} |
|
|
|
if(CollUtil.isNotEmpty(purchases)){ |
|
|
|
return purchases.stream().map(p -> { |
|
|
|
GovBizProjectProcureVO purchase = new GovBizProjectProcureVO(); |
|
|
|
purchase.setBaseProjName(project.getProjectName()); |
|
|
|
purchase.setAreaCode(RegionConst.RC_LS); |
|
|
|
purchase.setDeleted(Boolean.FALSE); |
|
|
|
purchase.setBaseBidName(p.getBidName()); |
|
|
|
purchase.setBasePurchasingAgencies(p.getAgency()); |
|
|
|
purchase.setBaseUnifiedCreditCode(p.getPurchaseSocialCreditCode()); |
|
|
|
purchase.setBaseConsDeprt(p.getSupplier()); |
|
|
|
purchase.setBaseConsDeprtUsci(p.getSupplierSocialCreditCode()); |
|
|
|
purchase.setBasePaymentTime(p.getTransactionTime()); |
|
|
|
purchase.setBaseProjPurchaseAmount(p.getTransactionAmount()); |
|
|
|
purchase.setBaseProjPurchaseWay(p.getPurchaseMethod()); |
|
|
|
purchase.setBasePurchaseCode(p.getBudgetExecConfirmNo()); |
|
|
|
purchase.setBaseWinningBidTime(p.getTransactionTime()); |
|
|
|
purchase.setBiddingFile(p.getAcceptanceLetter()); |
|
|
|
purchase.setPaymentProgress(paymentTotal[0]); |
|
|
|
purchase.setPurchaseContract(contract.getAttachment()); |
|
|
|
purchase.setSetProjCodeFinan(project.getFinancialCode()); |
|
|
|
purchase.setPurchaseFile(p.getBidDoc()); |
|
|
|
return purchase; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询项目 初验终验的 报告 |
|
|
|
* @param project |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private static String searchReportFile(ProjectDetailVO project,Integer firstIndex,Integer secondIndex) { |
|
|
|
if(Objects.isNull(project)){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(project.getFinalAcceptanceMaterials())){ |
|
|
|
return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); |
|
|
|
}else if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){ |
|
|
|
return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
private static String searchReportFileInner(String fileStr,Integer firstIndex,Integer secondIndex) { |
|
|
|
try{ |
|
|
|
JSONArray jsonArray = JSON.parseArray(fileStr); |
|
|
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jsonArray.get(firstIndex - 1))); |
|
|
|
JSONArray data = jsonObject.getJSONArray("data"); |
|
|
|
JSONObject wangong = JSON.parseObject(JSON.toJSONString(data.get(secondIndex - 1))); |
|
|
|
JSONArray files = wangong.getJSONArray("files"); |
|
|
|
return JSON.toJSONString(files); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("解析文件失败:",e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |