提交 ed94a319 authored 作者: hzh's avatar hzh

代码优化

上级 d3ee621e
...@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; ...@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* @author hzh * @author hzh
...@@ -56,7 +57,7 @@ public class HotelServiceImpl implements IHotelService { ...@@ -56,7 +57,7 @@ public class HotelServiceImpl implements IHotelService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), HotelShoppingPricePlanModel.class); return Optional.ofNullable(res.getData()).map(data->JSON.parseObject(JSON.parseObject(data).toJSONString(), HotelShoppingPricePlanModel.class)).orElse(null);
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论