admin
2020-05-31 2a48f2bd979d56ce4114ba9d56efaf49bab705d7
fanli/src/main/java/com/yeshi/fanli/util/suning/SuningUtil.java
@@ -26,4 +26,53 @@
      BigDecimal money = MoneyBigDecimalUtil.mul(afterUseCouponPrice, rate);
      return BigDecimalUtil.getWithNoZera(money).setScale(2);
   }
   /**
    * 获取拼接的商品ID
    * @Title: getConcatGoodsIId
    * @Description:
    * @param supplierCode
    * @param goodsId
    * @return
    * String 返回类型
    * @throws
    */
   public static String getConcatGoodsIId(String supplierCode, String goodsId) {
      return supplierCode + "-" + goodsId;
   }
   public static String getFullSupplierCode(String supplierCode){
      for (int i = 0; i < 10; i++) {
         if (supplierCode.length() < 10)
            supplierCode = "0" + supplierCode;
      }
      return supplierCode;
   }
   /**
    * 通过拼接的商品ID解析出来正确的商品ID
    * @Title: getGoodsIdDetail
    * @Description:
    * @param concatGoodsId
    * @return
    * String[] 返回类型
    * @throws
    */
   public static String[] getGoodsIdDetail(String concatGoodsId) {
      String[] sts = concatGoodsId.split("-");
      String supplierCode = sts[0];
      for (int i = 0; i < 10; i++) {
         if (supplierCode.length() < 10)
            supplierCode = "0" + supplierCode;
      }
      return new String[] { supplierCode, sts[1] };
   }
   public static String getProductUrl(String supplierCode, String goodsId) {
      return String.format("https://product.suning.com/%s/%s.html", supplierCode, goodsId);
   }
}