use of org.devgateway.ocvn.persistence.mongo.dao.VNTender in project ocvn by devgateway.
the class EBidAwardRowImporter method createReleaseFromReleaseRow.
@Override
public Release createReleaseFromReleaseRow(final String[] row) throws ParseException {
Release release = repository.findByPlanningBidNo(getRowCell(row, 0));
if (release == null) {
release = newReleaseFromAwardFactory(getRowCell(row, 0));
}
if (release.getTender() == null) {
VNTender tender = new VNTender();
tender.setId(release.getOcid());
release.setTender(tender);
}
release.getTender().getSubmissionMethod().add(Tender.SubmissionMethod.electronicSubmission);
VNAward award = new VNAward();
award.setId(release.getOcid() + "-award-" + release.getAwards().size());
release.getAwards().add(award);
Amount value = new Amount();
value.setCurrency("VND");
value.setAmount(getDecimal(getRowCell(row, 1)));
award.setValue(value);
Organization supplier = organizationRepository.findByAllIds(getRowCellUpper(row, 2));
if (supplier == null) {
supplier = OrganizationRepositoryUtil.newAndInsertOrganization(Organization.OrganizationType.supplier, getRowCellUpper(row, 2), organizationRepository);
} else {
supplier = OrganizationRepositoryUtil.ensureOrgIsOfTypeAndSave(supplier, Organization.OrganizationType.supplier, organizationRepository);
}
Organization supplierOrganization = supplier;
Detail detail = null;
if (supplierOrganization != null && getRowCell(row, 1) != null) {
Amount value2 = new Amount();
value2.setCurrency("VND");
value2.setAmount(getDecimal(getRowCell(row, 1)));
VNTendererOrganization tendererOrganization = new VNTendererOrganization(supplier);
tendererOrganization.setBidValue(value2);
supplierOrganization = tendererOrganization;
detail = newBidDetailFromAwardData(getRowCell(row, 0), value2, supplier);
}
award.setStatus("Y".equals(getRowCell(row, 5)) ? Award.Status.active : Award.Status.unsuccessful);
// active=successful awards have suppliers
if (Award.Status.active.equals(award.getStatus())) {
award.getSuppliers().add(supplier);
}
award.setContractTime(getRowCell(row, 3));
award.setBidOpenRank(getInteger(getRowCell(row, 4)));
award.setIneligibleYN(getRowCell(row, 6));
award.setIneligibleRson(getRowCell(row, 7));
if (getRowCell(row, 8) != null) {
award.setAlternateDate(getExcelDate(getRowCell(row, 8)));
}
if (getRowCell(row, 10) != null) {
award.setDate(getExcelDate(getRowCell(row, 10)));
}
if (getRowCell(row, 9) != null) {
award.setPublishedDate(getExcelDate(getRowCell(row, 9)));
}
// tenderers
if (supplierOrganization != null) {
release.getTender().getTenderers().add(supplierOrganization);
}
if (detail != null) {
release.getBids().getDetails().add(detail);
}
release.getTender().setNumberOfTenderers(release.getTender().getTenderers().size());
// copy items from tender
award.getItems().addAll(release.getTender().getItems());
checkForAwardOutliers(release, award);
return release;
}
use of org.devgateway.ocvn.persistence.mongo.dao.VNTender in project ocvn by devgateway.
the class TenderRowImporter method createReleaseFromReleaseRow.
@Override
public Release createReleaseFromReleaseRow(final String[] row) throws ParseException {
Release release = repository.findByPlanningBidNo(getRowCell(row, 0));
if (release == null) {
release = new Release();
release.setOcid(MongoConstants.OCDS_PREFIX + "bidno-" + getRowCell(row, 0));
release.getTag().add(Tag.tender);
VNPlanning planning = new VNPlanning();
release.setPlanning(planning);
planning.setBidNo(getRowCell(row, 0));
}
VNTender tender = (VNTender) release.getTender();
if (tender == null) {
tender = new VNTender();
tender.setId(release.getOcid());
release.setTender(tender);
}
readStatusFromReleaseRow(row, tender);
tender.setApproveState(getRowCell(row, 1));
tender.setCancelYN(getRowCell(row, 2));
tender.setModYn(getRowCell(row, 3));
tender.setBidMethod(getInteger(getRowCell(row, 4)));
readProcurementMethodFromReleaseRow(row, tender);
String contrMethodDetail = getRowCell(row, 6);
if (contrMethodDetail != null) {
ContrMethod contrMethod = contrMethodRepository.findByDetails(contrMethodDetail);
if (contrMethod == null) {
contrMethod = new ContrMethod();
contrMethod.setDetails(contrMethodDetail);
// switch (contrMethodId) {
// case 1:
// contrMethod.setDetails("Trọn gói");
// break;
// case 2:
// contrMethod.setDetails("Theo đơn giá");
// break;
// case 3:
// contrMethod.setDetails("Theo thời gian");
// break;
// case 4:
// contrMethod.setDetails("Theo tỷ lệ phần trăm");
// break;
// case 5:
// contrMethod.setDetails("Hỗn hợp");
// break;
// default:
// contrMethod.setDetails("Undefined");
// break;
// }
contrMethod = contrMethodRepository.insert(contrMethod);
}
tender.setContrMethod(contrMethod);
}
Period period = new Period();
period.setStartDate(getExcelDate(getRowCell(row, 7)));
period.setEndDate(getExcelDate(getRowCell(row, 8)));
tender.setTenderPeriod(period);
tender.setBidOpenDt(getExcelDate(getRowCell(row, 9)));
Organization procuringEntity = organizationRepository.findByAllIds(getRowCellUpper(row, 10));
if (procuringEntity == null) {
procuringEntity = OrganizationRepositoryUtil.newAndInsertOrganization(Organization.OrganizationType.procuringEntity, getRowCellUpper(row, 10), organizationRepository);
} else {
procuringEntity = OrganizationRepositoryUtil.ensureOrgIsOfTypeAndSave(procuringEntity, Organization.OrganizationType.procuringEntity, organizationRepository);
}
tender.setProcuringEntity(procuringEntity);
Organization orderInstituCd = organizationRepository.findByAllIds(getRowCellUpper(row, 11));
if (orderInstituCd == null) {
orderInstituCd = OrganizationRepositoryUtil.newAndInsertOrganization(Organization.OrganizationType.buyer, getRowCellUpper(row, 11), organizationRepository);
} else {
orderInstituCd = OrganizationRepositoryUtil.ensureOrgIsOfTypeAndSave(orderInstituCd, Organization.OrganizationType.procuringEntity, organizationRepository);
}
release.setBuyer(orderInstituCd);
if (getRowCell(row, 12) != null) {
Amount value = new Amount();
value.setCurrency("VND");
value.setAmount(getDecimal(getRowCell(row, 12)));
tender.setValue(value);
}
tender.setPublicationMethod(getRowCell(row, 14));
tender.setCancellationRationale(getRowCell(row, 15));
readLocationAndClassificationFromReleaseRow(row, tender);
return release;
}
use of org.devgateway.ocvn.persistence.mongo.dao.VNTender in project ocvn by devgateway.
the class BidPlansRowImporter method createReleaseFromReleaseRow.
@Override
public Release createReleaseFromReleaseRow(final String[] row) throws ParseException {
String projectID = getRowCell(row, 0);
Release release = repository.findByBudgetProjectId(projectID);
if (release == null) {
release = new Release();
release.getTag().add(Tag.planning);
release.setOcid(MongoConstants.OCDS_PREFIX + "prjid-" + projectID);
VNPlanning planning = new VNPlanning();
release.setPlanning(planning);
}
Budget budget = release.getPlanning().getBudget();
if (budget == null) {
budget = new Budget();
release.getPlanning().setBudget(budget);
}
budget.setProjectID(getRowCell(row, 0));
Amount value = new Amount();
value.setCurrency("VND");
budget.setAmount(value);
// decimal2
value.setAmount(getDecimal(getRowCell(row, 5)));
Tender tender = release.getTender();
if (tender == null) {
tender = new VNTender();
tender.setId(release.getOcid());
release.setTender(tender);
}
// create Items
VNItem item = new VNItem();
item.setId(Integer.toString(tender.getItems().size()));
tender.getItems().add(item);
// decimal2
value.setAmount(getDecimal(getRowCell(row, 5)));
item.setDescription(getRowCell(row, 1));
item.setBidPlanItemRefNum(getRowCell(row, 2));
item.setBidPlanItemStyle(getRowCell(row, 3));
item.setBidPlanItemFund(getRowCell(row, 4));
item.setBidPlanItemMethodSelect(getRowCell(row, 6));
item.setBidPlanItemMethod(getRowCell(row, 7));
item.setId(getRowCell(row, 8));
return release;
}
use of org.devgateway.ocvn.persistence.mongo.dao.VNTender in project ocvn by devgateway.
the class OfflineAwardRowImporter method createReleaseFromReleaseRow.
@Override
public Release createReleaseFromReleaseRow(final String[] row) throws ParseException {
Release release = repository.findByPlanningBidNo(getRowCell(row, 0));
if (release == null) {
release = newReleaseFromAwardFactory(getRowCell(row, 0));
}
if (release.getTender() == null) {
VNTender tender = new VNTender();
tender.setId(release.getOcid());
release.setTender(tender);
}
release.getTender().getSubmissionMethod().add(Tender.SubmissionMethod.written);
VNAward award = new VNAward();
award.setId(release.getOcid() + "-award-" + release.getAwards().size());
release.getAwards().add(award);
award.setTitle(getRowCell(row, 1));
if (getRowCell(row, 2) != null) {
Amount value = new Amount();
value.setCurrency("VND");
value.setAmount(getDecimal(getRowCell(row, 2)));
award.setValue(value);
}
Organization supplier = null;
if (getRowCell(row, 3) != null) {
supplier = organizationRepository.findByName(getRowCellUpper(row, 3));
if (supplier == null) {
supplier = OrganizationRepositoryUtil.newAndInsertOrganization(Organization.OrganizationType.supplier, getRowCellUpper(row, 3), organizationRepository);
} else {
supplier = OrganizationRepositoryUtil.ensureOrgIsOfTypeAndSave(supplier, Organization.OrganizationType.supplier, organizationRepository);
}
}
award.setStatus("Y".equals(getRowCell(row, 5)) ? Award.Status.active : Award.Status.unsuccessful);
// active=successful awards have suppliers
if (supplier != null && Award.Status.active.equals(award.getStatus())) {
award.getSuppliers().add(supplier);
}
award.setContractTime(getRowCell(row, 4));
award.setIneligibleYN(getRowCell(row, 6));
award.setIneligibleRson(getRowCell(row, 7));
award.setBidType(getInteger(getRowCell(row, 8)));
award.setBidSuccMethod(getInteger(getRowCell(row, 9)));
Organization supplierOrganization = supplier;
Detail detail = null;
if (supplierOrganization != null && getRowCell(row, 10) != null) {
Amount value2 = new Amount();
value2.setCurrency("VND");
value2.setAmount(getDecimal(getRowCell(row, 10)));
VNTendererOrganization tendererOrganization = new VNTendererOrganization(supplier);
tendererOrganization.setBidValue(value2);
supplierOrganization = tendererOrganization;
detail = newBidDetailFromAwardData(getRowCell(row, 0), value2, supplier);
}
if (getRowCell(row, 12) != null) {
award.setDate(getExcelDate(getRowCell(row, 12)));
award.setPublishedDate(getExcelDate(getRowCell(row, 12)));
}
if (getRowCell(row, 11) != null) {
award.setAlternateDate(getExcelDate(getRowCell(row, 11)));
detail.setDate(award.getAlternateDate());
}
// tenderers
if (supplierOrganization != null) {
release.getTender().getTenderers().add(supplierOrganization);
}
release.getTender().setNumberOfTenderers(release.getTender().getTenderers().size());
if (detail != null) {
release.getBids().getDetails().add(detail);
}
// copy items from tender
award.getItems().addAll(release.getTender().getItems());
checkForAwardOutliers(release, award);
return release;
}
Aggregations