diff --git a/src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java b/src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java index 81218c5..2e38d64 100644 --- a/src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java +++ b/src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java @@ -509,17 +509,22 @@ public class GoodsServiceImpl implements GoodsService { // 以identifiers为主键查询详情 JSONObject gdJson = SzwhApiUtils.apiGoodsDetail(identifiers); log.info(identifiers + "详情:" + gdJson); - //处理返回的结果 - JSONArray gdArr = gdJson.getJSONArray("data"); // 如果goods表中存在记录,不进行操作 Goods tgoods = goodsMapper.getGoodsByIsli(goodsId); if (tgoods != null) { continue; } + //处理返回的结果 + JSONArray gdArr = gdJson.getJSONArray("data"); + if(gdArr==null){ + continue; + }else { + log.info(gdArr.size()); + } // add goodsSource,循环插入 商品资源 for (int x = 0; x < gdArr.size(); x++) { // 从里面取出数据 - JSONObject gditem = (JSONObject) gdArr.get(i); + JSONObject gditem = (JSONObject) gdArr.get(x); // 商品详情json非空时候 if (gditem != null) { GoodsSource goodsSource = ApiGoodsUtils.jsonToGoodsSource(gditem, goodsId); @@ -585,8 +590,8 @@ public class GoodsServiceImpl implements GoodsService { int fdays = festivalsMapper.countDayBetweenDays(wtStart, wtEnd, iyear); // 节假日顺延后的日期 Date fwtEnd = DateUtils.daysAgoOrAfter(wtEnd, fdays); - cend = fwtEnd.toString(); - ncet=new Timestamp(fwtEnd.getTime()); + cend = sdf.format(fwtEnd)+" 23:59:59"; + ncet=new Timestamp(sdf.parse(cend).getTime()); } catch (Exception ex) { log.error("一次性委托日期转码出错:" + ex.getLocalizedMessage()); } @@ -601,13 +606,12 @@ public class GoodsServiceImpl implements GoodsService { istatus = 1; } // 到期自动下架 - if (nowStr.equals(cend)) { + if (nowStr.equals("2099-12-31")) { istatus = 2; } } } - //String ncend = cend + " 23:59:59"; - + //bind to goods properties goods.setContractualStartTime(ncst); goods.setContractualtimeEndTime(ncet);