Ejemplo n.º 1
0
  @Override
  public Response<Integer> bulkImportMainBusinessApprover(String excelPath) {

    Response<Integer> result = new Response<Integer>();

    if (Strings.isNullOrEmpty(excelPath)) {
      log.error("excel path can not be null");
      result.setError("excel.path.not.null.fail");
      return result;
    }

    try {
      List<MainBusinessApprover> mainBusinessApprovers =
          excelTransform.getMainBusinessApprover(excelPath);
      if (mainBusinessApprovers == null || mainBusinessApprovers.isEmpty()) {
        log.error("approvers not found");
        result.setError("approvers.not.found");
        return result;
      }

      Integer count = accountManager.bulkCreateMainBusinessApprover(mainBusinessApprovers);

      result.setResult(count);
      return result;
    } catch (Exception e) {
      log.error(
          "fail to import approver where excel path={},cause:{}",
          excelPath,
          Throwables.getStackTraceAsString(e));
      result.setError("import.approver.fail");
      return result;
    }
  }
Ejemplo n.º 2
0
  @Override
  public Response<Boolean> bulkImportSupplierTQRDCInfo(String excelPath) {
    Response<Boolean> result = new Response<Boolean>();

    if (Strings.isNullOrEmpty(excelPath)) {
      log.error("excel path can not be null");
      result.setError("excel.path.not.null.fail");
      return result;
    }

    try {
      List<SupplierTQRDCInfo> supplierTQRDCInfos = excelTransform.getSupplierTQRDCInfo(excelPath);
      if (supplierTQRDCInfos == null) {
        log.error("supplier TQRDC information not found");
        result.setError("supplier.tqrdc.not.found");
        return result;
      }

      accountManager.bulkCreateSupplierQTRDCInfo(supplierTQRDCInfos);

      result.setResult(Boolean.TRUE);
      return result;
    } catch (Exception e) {
      log.error(
          "fail to import supplier TQRDC information where excel url={},cause:{}",
          excelPath,
          Throwables.getStackTraceAsString(e));
      result.setError("import.supplier.tqrdc.info.fail");
      return result;
    }
  }