|
|
|
@ -87,6 +87,7 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据类型查找用户信息 |
|
|
|
* |
|
|
|
* @param type |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ -510,26 +511,26 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
String goodsId = nsdjson.getString("identifier"); |
|
|
|
// 以identifier为主键查询详情
|
|
|
|
JSONObject rqjson = new JSONObject(); |
|
|
|
rqjson.put("isliCode",goodsId); |
|
|
|
JSONObject gdJson=SzwhApiUtils.apiGoodsDetail(rqjson.toJSONString()); |
|
|
|
rqjson.put("isliCode", goodsId); |
|
|
|
JSONObject gdJson = SzwhApiUtils.apiGoodsDetail(rqjson.toJSONString()); |
|
|
|
log.info(goodsId + "详情:" + gdJson); |
|
|
|
//处理返回的结果
|
|
|
|
//JSONArray gdArr = gdJson.getJSONArray("data");
|
|
|
|
JSONArray gdArr = gdJson.getJSONArray("data"); |
|
|
|
// 如果goods表中存在记录,不进行操作
|
|
|
|
Goods tgoods = goodsMapper.getGoodsByIsli(goodsId); |
|
|
|
if (tgoods != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// add goodsSource,循环插入 商品资源
|
|
|
|
// for (int x = 0; x < gdArr.size(); x++) {
|
|
|
|
// 从里面取出数据
|
|
|
|
JSONObject gditem = gdJson.getJSONObject("data"); |
|
|
|
// 商品详情json非空时候
|
|
|
|
if (gditem != null) { |
|
|
|
GoodsSource goodsSource = ApiGoodsUtils.jsonToGoodsSource(gditem, goodsId); |
|
|
|
goodsSourceMapper.add(goodsSource); |
|
|
|
for (int x = 0; x < gdArr.size(); x++) { |
|
|
|
// 从里面取出数据
|
|
|
|
JSONObject gditem = (JSONObject) gdArr.get(i); |
|
|
|
// 商品详情json非空时候
|
|
|
|
if (gditem != null) { |
|
|
|
GoodsSource goodsSource = ApiGoodsUtils.jsonToGoodsSource(gditem, goodsId); |
|
|
|
goodsSourceMapper.add(goodsSource); |
|
|
|
} |
|
|
|
} |
|
|
|
// }
|
|
|
|
// insertGoodsDetail
|
|
|
|
GoodsDetail goodsDetail = ApiGoodsUtils.jsonToGoodsDetail(nsdjson, sdjson); |
|
|
|
// 返回商品详情
|
|
|
|
@ -564,7 +565,7 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
//转换为date
|
|
|
|
String cend = nsdjson.getString("contractualPeriodEnd"); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(cend) && day!=null) { |
|
|
|
if (StringUtils.isBlank(cend) && day != null) { |
|
|
|
//如果是一次性授权或单次授权,存在托管结束时间
|
|
|
|
if (iperiod == 2) { |
|
|
|
try { |
|
|
|
@ -575,30 +576,30 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
int wkday = calendar.get(Calendar.DAY_OF_WEEK); |
|
|
|
//周末顺延
|
|
|
|
// notice:在节假日调休时候,会有变动
|
|
|
|
day=wkday>5?(wkday-5+1):0; |
|
|
|
day = wkday > 5 ? (wkday - 5 + 1) : 0; |
|
|
|
// 委托终止时间
|
|
|
|
Date wtEnd = DateUtils.daysAgoOrAfter(wtStart, day); |
|
|
|
// 统计该时间段内的节假日
|
|
|
|
int fdays = festivalsMapper.countDayBetweenDays(wtStart,wtEnd,iyear); |
|
|
|
int fdays = festivalsMapper.countDayBetweenDays(wtStart, wtEnd, iyear); |
|
|
|
// 节假日顺眼后的日期
|
|
|
|
Date fwtEnd= DateUtils.daysAgoOrAfter(wtEnd,fdays); |
|
|
|
Date fwtEnd = DateUtils.daysAgoOrAfter(wtEnd, fdays); |
|
|
|
cend = fwtEnd.toString(); |
|
|
|
} catch (Exception ex) { |
|
|
|
log.error("一次性委托日期转码出错:"+ex.getStackTrace()); |
|
|
|
log.error("一次性委托日期转码出错:" + ex.getStackTrace()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 周期委托
|
|
|
|
if(iperiod==3){ |
|
|
|
if (iperiod == 3) { |
|
|
|
//当前时间
|
|
|
|
SimpleDateFormat nowDateSdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String nowStr = nowDateSdf.format(new Date()); |
|
|
|
// 判断是否为当前时间 上架状态
|
|
|
|
if(nowStr.equals(cstart)){ |
|
|
|
istatus=1; |
|
|
|
if (nowStr.equals(cstart)) { |
|
|
|
istatus = 1; |
|
|
|
} |
|
|
|
// 到期自动下架
|
|
|
|
if(nowStr.equals(cend)){ |
|
|
|
istatus=2; |
|
|
|
if (nowStr.equals(cend)) { |
|
|
|
istatus = 2; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|