/**
   * 顧客コードから顧客と請求先情報を取得します( 完全一致版).<br>
   * 顧客コードが完全に一致しない場合は値が返りません.
   *
   * @return 納入先情報(1件)
   * @throws Exception
   */
  @Execute(validator = false, urlPattern = "getCustomerAndBillInfosByCustomerCode/{customerCode}")
  public String getCustomerAndBillInfosByCustomerCode() throws Exception {

    // 顧客コードを指定しない場合は検索しません
    if (!StringUtil.hasLength(commonDeliveryForm.customerCode)) {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    List<DeliveryAndPre> deliveryList;
    try {
      deliveryList =
          deliveryService.searchDeliveryByCompleteCustomerCode(commonDeliveryForm.customerCode);

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    // 納入先コードを指定した検索なので複数はかえらない
    if (deliveryList.size() == 1) {

      BeanMap map = super.createBeanMapWithNullToEmpty(deliveryList.get(0));
      ResponseUtil.write(JSON.encode(map), "text/javascript");

    } else {
      ResponseUtil.write("", "text/javascript");
    }
    return null;
  }
Exemplo n.º 2
0
  /**
   * 商品コードから商品数を取得します(前方一致).
   *
   * @return 商品数
   * @throws Exception
   */
  @Execute(validator = false)
  public String getProductByCodeLike() throws Exception {
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
    try {

      List<Product> productList =
          productService.findProductByCodeLike(commonProductForm.productCode);
      if (productList == null || productList.size() == 0) {
        map.put(Param.PRODUCT_COUNT, String.valueOf("0"));
        ResponseUtil.write(JSON.encode(map), "text/javascript");
      } else {

        if (productList.size() == 1) {
          Product product = productList.get(0);
          BeanMap bmap = super.createBeanMapWithNullToEmpty(product);
          bmap.put(Param.PRODUCT_COUNT, String.valueOf(productList.size()));
          ResponseUtil.write(JSON.encode(bmap), "text/javascript");
        } else {
          map.put(Param.PRODUCT_COUNT, String.valueOf(productList.size()));
          ResponseUtil.write(JSON.encode(map), "text/javascript");
        }
      }

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
Exemplo n.º 3
0
  /**
   * レートIDからレートマスタの情報を取得します.
   *
   * @return レートマスタ情報
   * @throws Exception
   */
  @Execute(validator = false, urlPattern = "getRateInfosByRateId/{rateId}")
  public String getRateInfosByRateId() throws Exception {

    if (!StringUtil.hasLength(commonRateForm.rateId)) {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    try {

      Rate rate = rateService.findById(commonRateForm.rateId);

      if (rate != null) {

        BeanMap map =
            Beans.createAndCopy(BeanMap.class, rate)
                .dateConverter(Constants.FORMAT.TIMESTAMP, "creDatetm", "updDatetm")
                .execute();

        BeanMap bmap = super.createBeanMapWithNullToEmpty(map);
        ResponseUtil.write(JSON.encode(bmap), "text/javascript");

      } else {
        ResponseUtil.write("", "text/javascript");
      }

    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
Exemplo n.º 4
0
  /** AbstractInterceptorを継承する際に、実装する必要のあるメソッド。 割り込ませる処理を記述。 */
  @Override
  public Object invoke(MethodInvocation invocation) throws Throwable {

    //		Map<String, Object> sessionScope = SingletonS2Container.getComponent("sessionScope");
    //		LoginUserDto loginDto = (LoginUserDto) sessionScope.get("loginUserDto");
    //		// loginDtoがNULLだったり、NULLでなくてもコードがNULLの場合タイムアウトと見なす。
    //		if (loginDto == null || loginDto.userId == null) {
    //			// タイムアウト画面
    //			return "/";
    //		}

    String loginCookieValue = cookieService.getCookieValue("_coupon_island_login_");
    String fbLoginCookieValue = cookieService.getCookieValue("_coupon_island_fb_login_");
    IUserLogin userLogin = null;
    if (StringUtils.isEmpty(loginCookieValue) && StringUtils.isEmpty(fbLoginCookieValue)) {
      return "/";
    } else if (StringUtils.isNotEmpty(loginCookieValue)) {
      userLogin = loginService.getIUserLogin(loginCookieValue);
      if (userLogin == null) {
        Cookie c = new Cookie("_coupon_island_login_", null);
        c.setMaxAge(0); // 即死にする
        c.setPath(RequestUtil.getRequest().getContextPath());
        ResponseUtil.getResponse().addCookie(c);
      }
    } else if (StringUtils.isNotEmpty(fbLoginCookieValue)) {
      userLogin = loginService.getIUserLogin(fbLoginCookieValue);
      if (userLogin == null) {
        Cookie c = new Cookie("_coupon_island_fb_login_", null);
        c.setMaxAge(0); // 即死にする
        c.setPath(RequestUtil.getRequest().getContextPath());
        ResponseUtil.getResponse().addCookie(c);
      }
    }

    if (userLogin == null) {
      return "/";
    }

    loginUserDto.userId = userLogin.userId;

    return invocation.proceed();
  }
  /**
   * 顧客コードから納入先リストを返します.<br>
   * 顧客コードが完全に一致しない場合は値が返りません.<br>
   * 返す値は、納入先コードと納入先名のリスト、かつ、作成日の昇順で、請求先は除外しています.<br>
   * mapの内容は key = "value" + No name = 納入先コード、納入先名の順番です.
   *
   * @return 納入先リスト情報
   * @throws Exception
   */
  @Execute(validator = false)
  public String getDeliveryListByCustomerCodeSortedByCreDate() throws Exception {

    // 顧客コードを指定しない場合は検索しません
    if (!StringUtil.hasLength(commonDeliveryForm.customerCode)) {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    List<DeliveryAndPre> deliveryList;
    try {
      deliveryList =
          deliveryService.searchDeliveryByCompleteCustomerCodeSortedByCreDate(
              commonDeliveryForm.customerCode);

      // 納入先コードと納入先名を返す
      int i = 0;
      String key;
      Map<String, Object> param = new HashMap<String, Object>();
      for (DeliveryAndPre dap : deliveryList) {
        key = "value" + Integer.toString(i);
        param.put(key, dap.deliveryCode);
        key = "name" + Integer.toString(i);
        param.put(key, dap.deliveryName);
        i++;
      }
      if (deliveryList.size() != 0) {
        BeanMap map = super.createBeanMapWithNullToEmpty(param);
        ResponseUtil.write(JSON.encode(map), "text/javascript");
      } else {
        ResponseUtil.write("", "text/javascript");
      }
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }

    return null;
  }
Exemplo n.º 6
0
  /**
   * 全通貨記号を取得します.
   *
   * @return 全通貨記号
   * @throws Exception
   */
  @Execute(validator = false)
  public String getAllRateSign() throws Exception {
    try {
      List<Rate> rateList = rateService.findAllRate();
      Map<String, Object> rateMap = new HashMap<String, Object>();
      for (Rate rate : rateList) {

        rateMap.put(Integer.toString(rate.rateId), rate.sign);
      }

      if (rateList.size() != 0) {
        BeanMap map = super.createBeanMapWithNullToEmpty(rateMap);
        ResponseUtil.write(JSON.encode(map), "text/javascript");
      } else {
        ResponseUtil.write("", "text/javascript");
      }
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    return null;
  }
Exemplo n.º 7
0
  /**
   * 商品コードから商品情報を取得します.
   *
   * @return 商品情報
   * @throws Exception
   */
  @Execute(validator = false)
  public String getProductInfos() throws Exception {
    ProductJoin product;
    int movableQuantity;
    try {

      product = productService.findById(commonProductForm.productCode);
      this.stockInfoDto =
          this.productStockService.calcStockQuantityByProductCode(commonProductForm.productCode);

      if (product != null && !StringUtil.hasLength(commonProductForm.rackCode)) {
        commonProductForm.rackCode = product.rackCode;
      }

      int unclosedQuantity =
          eadService.countUnclosedQuantityByProductCode(
              commonProductForm.productCode, commonProductForm.rackCode);
      int closedQuantity =
          productStockService.countClosedQuantityByProductCode(
              commonProductForm.productCode, commonProductForm.rackCode);
      movableQuantity = unclosedQuantity + closedQuantity;
    } catch (ServiceException e) {
      super.errorLog(e);
      throw e;
    }
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();

    if (product != null) {
      map.put(Param.SUPPLIER_CODE, (product.supplierCode == null ? "" : product.supplierCode));
      map.put(Param.PRODUCT_NAME, (product.productName == null ? "" : product.productName));
      map.put(Param.SUPPLIER_PCODE, (product.supplierPcode == null ? "" : product.supplierPcode));
      map.put(Param.PO_LOT, (product.poLot == null ? "" : product.poLot.toString()));
      map.put(Param.MAX_PO_NUM, (product.maxPoNum == null ? "" : product.maxPoNum.toString()));
      map.put(
          Param.MAX_STOCK_NUM, (product.maxStockNum == null ? "" : product.maxStockNum.toString()));
      map.put(
          Param.DISCARD_DATE,
          (product.discardDate == null ? "" : DF_YMD.format(product.discardDate)));
      map.put(
          Param.SUPPLIER_PRICE_YEN,
          (product.supplierPriceYen == null ? "" : product.supplierPriceYen.toString()));
      map.put(
          Param.SUPPLIER_PRICE_DOL,
          (product.supplierPriceDol == null ? "" : product.supplierPriceDol.toString()));
      map.put(Param.RACK_CODE, (product.rackCode == null ? "" : product.rackCode));

      map.put(
          Param.RETAIL_PRICE, (product.retailPrice == null ? "" : product.retailPrice.toString()));

      map.put(Param.RO_MAX_NUM, (product.roMaxNum == null ? "" : product.roMaxNum.toString()));

      map.put(
          Param.SET_TYPE_CATEGORY,
          (product.setTypeCategory == null ? "" : product.setTypeCategory));

      map.put(Param.DISCARDED, (product.discarded == null ? "" : product.discarded));

      map.put(Param.TAX_CATEGORY, (product.taxCategory == null ? "" : product.taxCategory));

      map.put(Param.REMARKS, (product.remarks == null ? "" : product.remarks));

      map.put(Param.EAD_REMARKS, (product.eadRemarks == null ? "" : product.eadRemarks));

      map.put(Param.UNIT_CATEGORY, (product.unitCategory == null ? "" : product.unitCategory));

      map.put(
          Param.UNIT_CATEGORY_NAME,
          (product.unitCategoryName == null ? "" : product.unitCategoryName));

      map.put(Param.ONLINE_PCODE, (product.onlinePcode == null ? "" : product.onlinePcode));

      map.put(
          Param.PACK_QUANTITY,
          (product.packQuantity == null ? "" : product.packQuantity.toString()));

      map.put(Param.LENGTH, (product.length == null ? "" : product.length.toString()));

      map.put(Param.SO_RATE, (product.soRate == null ? "" : product.soRate.toString()));

      map.put(
          Param.STOCK_CTL_CATEGORY,
          (product.stockCtlCategory == null ? "" : product.stockCtlCategory));
    } else {
      ResponseUtil.write("", "text/javascript");
      return null;
    }

    map.put(
        ShowStockInfoDialogAction.Param.PRODUCT_CODE,
        (stockInfoDto.productCode == null ? "" : stockInfoDto.productCode));
    map.put(
        ShowStockInfoDialogAction.Param.CURRENT_TOTAL_QUANTITY,
        (String.valueOf(stockInfoDto.currentTotalQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.RORDER_REST_QUANTITY,
        (String.valueOf(stockInfoDto.rorderRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.PORDER_REST_QUANTITY,
        (String.valueOf(stockInfoDto.porderRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.ENTRUST_REST_QUANTITY,
        (String.valueOf(stockInfoDto.entrustRestQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.POSSIBLE_DROW_QUANTITY,
        (String.valueOf(stockInfoDto.possibleDrawQuantity)));
    map.put(
        ShowStockInfoDialogAction.Param.HOLDING_STOCK_QUANTITY,
        (String.valueOf(stockInfoDto.holdingStockQuantity)));

    if (StringUtil.hasLength(commonProductForm.rackCode)) {
      map.put(Param.MOVABLE_QUANTITY, String.valueOf(movableQuantity));
    } else {
      map.put(Param.MOVABLE_QUANTITY, "");
    }

    ResponseUtil.write(JSON.encode(map), "text/javascript");

    return null;
  }