Commit 2a34daab authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev-tiande' into dev-tiande

parents f6d41fc4 9a8512f6
...@@ -48,4 +48,8 @@ public class GoodDataVO{ ...@@ -48,4 +48,8 @@ public class GoodDataVO{
@ApiModelProperty("seo*html标签优化") @ApiModelProperty("seo*html标签优化")
private String imgDesc; private String imgDesc;
private String distance;
private String labels;
} }
...@@ -44,13 +44,15 @@ public class AppHomeController extends BaseController<CofigBiz,Cofig> { ...@@ -44,13 +44,15 @@ public class AppHomeController extends BaseController<CofigBiz,Cofig> {
public ObjectRestResponse<List<GoodDataVO>> goodList( public ObjectRestResponse<List<GoodDataVO>> goodList(
@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit, @RequestParam(value = "limit",defaultValue = "4") Integer limit,
@RequestParam(value = "type",defaultValue = "1") Integer type @RequestParam(value = "type",defaultValue = "1") Integer type,
@RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude
){ ){
List<GoodDataVO> list=new ArrayList<>(); List<GoodDataVO> list=new ArrayList<>();
if (type==2){ if (type==2){
list=tourFeign.goodList(page,limit); list=tourFeign.goodList(page,limit);
}else if (type==3){ }else if (type==3){
list=campsiteFeign.goodList(page,limit); list=campsiteFeign.goodList(page,limit,longitude,latitude);
}else if (type==4){ }else if (type==4){
return vehicleFeign.goodList(page,limit); return vehicleFeign.goodList(page,limit);
} }
......
...@@ -27,7 +27,9 @@ public interface CampsiteFeign { ...@@ -27,7 +27,9 @@ public interface CampsiteFeign {
@ApiOperation("首页营地列表") @ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList") @GetMapping(value = "/app/shopList")
List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page, List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "4") Integer limit); @RequestParam(value = "limit", defaultValue = "4") Integer limit,
@RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude);
@GetMapping(value = "/app/unauth/findRandomVehicle") @GetMapping(value = "/app/unauth/findRandomVehicle")
ObjectRestResponse findRandomVehicle(@RequestParam(value = "number") Integer number); ObjectRestResponse findRandomVehicle(@RequestParam(value = "number") Integer number);
......
...@@ -82,8 +82,26 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -82,8 +82,26 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
* @param limit * @param limit
* @return * @return
*/ */
public List<GoodDataVO> getAllByHome(Integer page, Integer limit) { public List<GoodDataVO> getAllByHome(Integer page, Integer limit,Double lat ,Double lon) {
return mapper.findAllByHome((page - 1) * limit, limit); List<GoodDataVO>list = new ArrayList<GoodDataVO>();
if(lat != null && lat > 0 && lon != null && lon > 0){
list = mapper.findAllAndJlByHome((page - 1) * limit, limit,lat,lon);
}else{
list = mapper.findAllByHome((page - 1) * limit, limit);
}
//增加标签
for(GoodDataVO goodDataVO : list){
List<CampsiteShopTagDTO> listTag= campsiteShopTagBiz.findByCampsiteShopId(goodDataVO.getId());
if(listTag.size() > 0){
String labels = "";
for(CampsiteShopTagDTO campsiteShopTagDTO : listTag){
labels += campsiteShopTagDTO.getName() + ",";
}
labels = labels.substring(0,labels.length()-1);
goodDataVO.setLabels(labels);
}
}
return list;
} }
......
...@@ -33,6 +33,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -33,6 +33,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/ */
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size); List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<GoodDataVO> findAllAndJlByHome(@Param("start") Integer start, @Param("size") Integer size,@Param("lat")Double lat,@Param("lon")Double lon);
List<GoodDataVO> findAll(); List<GoodDataVO> findAll();
/** /**
......
...@@ -67,8 +67,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -67,8 +67,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
@ApiOperation("首页营地列表") @ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList") @GetMapping(value = "/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page, public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "4") Integer limit) { @RequestParam(value = "limit", defaultValue = "4") Integer limit,
return getBaseBiz().getAllByHome(page, limit); @RequestParam(value = "longitude", required = false) Double longitude,
@RequestParam(value = "latitude", required = false) Double latitude) {
return getBaseBiz().getAllByHome(page, limit,longitude,latitude);
} }
@ApiOperation("随机获取营地") @ApiOperation("随机获取营地")
......
...@@ -94,6 +94,19 @@ ...@@ -94,6 +94,19 @@
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER} limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select> </select>
<select id="findAllAndJlByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc`,
ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0
- #{lat} * PI() / 180.0)/2), 2)
+COS( latitude * PI() / 180.0)*COS(#{lat} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{lon} * PI() /
180.0)/2),2))))*6378.137)*10000)/10000 as distance
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select>
<select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO"> <select id="findAll" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc` select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`,cs.longitude,cs.latitude,cs.alt,cs.img_title as `imgTitle`,cs.img_keyword as `imgKeyword`,cs.img_desc as `imgDesc`
FROM `campsite_shop` cs FROM `campsite_shop` cs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment