admin
2019-11-12 ca3e865a9e3c22fc24c7ca4b67ad8c25d3f2ef18
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -72,6 +72,7 @@
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TaoBaoHttpUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -782,7 +783,41 @@
      // labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
      // tg.setLabels(labels);
      // }
      return tg;
      return loadYuShouInfo(tg, tb);
   }
   private static TaoBaoGoodsBriefExtra loadYuShouInfo(TaoBaoGoodsBriefExtra extra, TaoBaoGoodsBrief goods) {
      if (goods != null && extra != null) {
         if (isYUShou(goods)) {// 预售商品
//            extra.setZkPrice(new BigDecimal(goods.getPresaleDeposit()));
            // 预售
            if (extra.getLabels() == null)
               extra.setLabels(new ArrayList<>());
            extra.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E"));
         }
      }
      return extra;
   }
   /**
    * 是否为预售商品
    *
    * @param goods
    * @return
    */
   public static boolean isYUShou(TaoBaoGoodsBrief goods) {
      if (!StringUtil.isNullOrEmpty(goods.getPresaleDeposit())
            && !StringUtil.isNullOrEmpty(goods.getPresaleStartTime())
            && !StringUtil.isNullOrEmpty(goods.getPresaleEndTime())) {
         long startTime = Long.parseLong(goods.getPresaleStartTime());
         long endTime = Long.parseLong(goods.getPresaleEndTime());
         long now = System.currentTimeMillis();
         if (now >= startTime && now < endTime) {
            return true;
         }
      }
      return false;
   }
   /**
@@ -1398,7 +1433,6 @@
    */
   public static BigDecimal getGoodsHongBaoMoney(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) {
      BigDecimal money = null;
      if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo())
            || goodsBrief.getCouponInfo().trim().equalsIgnoreCase("无")) {
         money = MoneyBigDecimalUtil.mul(
@@ -2065,6 +2099,24 @@
      return token;
   }
   /**
    * 提取自有格式的淘口令
    *
    * @param str
    * @return
    */
   public static String parseSystemTaoToken(String str) {
      String pattern = "(\\({1}[A-Za-z0-9]+\\){1})";
      Pattern r = Pattern.compile(pattern);
      Matcher m = r.matcher(str);
      while (m.find()) {
         String group = m.group(0);
         if (!StringUtil.isNullOrEmpty(group))
            return group;
      }
      return null;
   }
   public static boolean isSpecialGoods(Integer materialLibType) {
      if (materialLibType != null && materialLibType == 1)
         return true;