|
|
|
@ -213,27 +213,16 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object getLogisticsMsg(Long orderGoodsId) { |
|
|
|
|
Object data = redisUtil.get(CACHE_KEY + orderGoodsId); |
|
|
|
|
public Object getLogisticsMsg(String logisticsNo) { |
|
|
|
|
Object data = redisUtil.get(CACHE_KEY + logisticsNo); |
|
|
|
|
if (data == null) { |
|
|
|
|
BsOrderGoods orderGoods = queryDetail(orderGoodsId); |
|
|
|
|
if (orderGoods == null || orderGoods.getLogisticsNo() == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONObject jsonObjects = OrderUtil.getLogisticsMsg(orderGoods.getLogisticsNo()); |
|
|
|
|
|
|
|
|
|
JSONObject jsonObjects = OrderUtil.getLogisticsMsg(logisticsNo); |
|
|
|
|
if (jsonObjects == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!"); |
|
|
|
|
} |
|
|
|
|
redisUtil.set(CACHE_KEY + orderGoods.getLogisticsNo(), jsonObjects, CACHE_TIME); |
|
|
|
|
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) { |
|
|
|
|
jsonObjects.getJSONObject("data").put("orderId" , orderGoodsId); |
|
|
|
|
GoodsLogistics logistics = editLogistics((JSONObject) jsonObjects.get("data")); |
|
|
|
|
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus()); |
|
|
|
|
orderGoods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); |
|
|
|
|
update(orderGoods); |
|
|
|
|
return cache(orderGoodsId , logistics); |
|
|
|
|
return cache(logisticsNo , logistics); |
|
|
|
|
} |
|
|
|
|
return jsonObjects; |
|
|
|
|
} else { |
|
|
|
@ -242,16 +231,16 @@ public class BsOrderGoodsServiceImpl implements BsOrderGoodsService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public GoodsLogistics cache(Long orderGoodsId , GoodsLogistics logistics) { |
|
|
|
|
public GoodsLogistics cache(String getLogisticsNo , GoodsLogistics logistics) { |
|
|
|
|
// 缓存
|
|
|
|
|
redisUtil.set(CACHE_KEY + orderGoodsId, logistics, CACHE_TIME); |
|
|
|
|
redisUtil.set(CACHE_KEY + getLogisticsNo, logistics, CACHE_TIME); |
|
|
|
|
return logistics; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void cacheDelete(Long orderGoodsId) { |
|
|
|
|
public void cacheDelete(String getLogisticsNo) { |
|
|
|
|
// 缓存
|
|
|
|
|
redisUtil.del(CACHE_KEY + orderGoodsId); |
|
|
|
|
redisUtil.del(CACHE_KEY + getLogisticsNo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|