Commit 9c9d6e86 authored by jiaorz's avatar jiaorz

新增车型、旅游、营地的随机获取列表接口

parent abd5649a
package com.xxfc.platform.campsite.feign; package com.xxfc.platform.campsite.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -20,5 +21,6 @@ public interface CampsiteFeign { ...@@ -20,5 +21,6 @@ public interface CampsiteFeign {
@GetMapping(value = "/campsiteShop/app/shopList") @GetMapping(value = "/campsiteShop/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);
@GetMapping(value = "/campsiteShop/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value = "number")Integer number);
} }
...@@ -2,6 +2,8 @@ package com.xxfc.platform.campsite.biz; ...@@ -2,6 +2,8 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.vo.GoodDataVO; import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.campsite.dto.*; import com.xxfc.platform.campsite.dto.*;
...@@ -336,6 +338,28 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> { ...@@ -336,6 +338,28 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
.toEpochMilli(); .toEpochMilli();
} }
/**
* 获取指定数量的随机旅游路线
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 2 : number;
List<GoodDataVO> list = mapper.findAll();
Set<GoodDataVO> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(list)) {
if(number == list.size()) {
return ObjectRestResponse.succ(list);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(list.size(), number, set);
for(Integer i : set) {
resultList.add(list.get(i));
}
}
return ObjectRestResponse.succ(resultList);
}
private long transformEndTime(Long endTime) { private long transformEndTime(Long endTime) {
return LocalDateTime.ofInstant(new Date(endTime).toInstant(), ZoneOffset.ofHours(+8)) return LocalDateTime.ofInstant(new Date(endTime).toInstant(), ZoneOffset.ofHours(+8))
......
...@@ -35,6 +35,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -35,6 +35,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> findAll();
/** /**
* 根据店铺id查询 * 根据店铺id查询
* @param id * @param id
...@@ -72,4 +74,6 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -72,4 +74,6 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
* @return * @return
*/ */
int checkNameExist(@Param("id") Integer id,@Param("name") String name); int checkNameExist(@Param("id") Integer id,@Param("name") String name);
} }
...@@ -59,5 +59,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -59,5 +59,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return getBaseBiz().getAllByHome(page,limit); return getBaseBiz().getAllByHome(page,limit);
} }
@ApiOperation("随机获取营地")
@GetMapping(value = "/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(Integer number) {
return baseBiz.findRandomVehicle(number);
}
} }
\ No newline at end of file
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER} limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select> </select>
<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
FROM `campsite_shop` cs
where cs.sale_state=1 and cs.is_del=0
order by cs.hot desc
</select>
<!--根据id查询详情--> <!--根据id查询详情-->
<select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO"> <select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO">
select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`,`service_phone` as `phone`,`logo` as `logo`,`poster_background` as `posterBackground` , select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`,`service_phone` as `phone`,`logo` as `logo`,`poster_background` as `posterBackground` ,
......
...@@ -104,4 +104,7 @@ public interface TourFeign { ...@@ -104,4 +104,7 @@ public interface TourFeign {
@GetMapping("/spe/departure_date") @GetMapping("/spe/departure_date")
Date selectDepartureDataBySpeId(@RequestParam(value = "speIds") Integer speIds); Date selectDepartureDataBySpeId(@RequestParam(value = "speIds") Integer speIds);
@GetMapping(value = "/tourGood/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value = "number")Integer number);
} }
...@@ -329,7 +329,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -329,7 +329,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
* @return * @return
*/ */
public ObjectRestResponse findRandomVehicle(Integer number) { public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number; number = number == null ? 2 : number;
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
List<TourGood> list = mapper.getCoordinateList(param); List<TourGood> list = mapper.getCoordinateList(param);
Set<TourGood> resultList = new HashSet<>(); Set<TourGood> resultList = new HashSet<>();
......
...@@ -39,6 +39,9 @@ public interface VehicleFeign { ...@@ -39,6 +39,9 @@ public interface VehicleFeign {
@PostMapping("/active/small/arrival") @PostMapping("/active/small/arrival")
public RestResponse arrivalBySmall(@RequestBody VehicleArrivalVo arrivalVo); public RestResponse arrivalBySmall(@RequestBody VehicleArrivalVo arrivalVo);
@GetMapping(value = "/vehicleModel/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(@RequestParam(value="number")Integer number);
//修改评分 //修改评分
@RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET) @RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score); public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score);
......
...@@ -78,7 +78,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> { ...@@ -78,7 +78,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
* @return * @return
*/ */
public ObjectRestResponse findRandomVehicle(Integer number) { public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number; number = number == null ? 2 : number;
VehicleModelQueryCondition vmqc = new VehicleModelQueryCondition(); VehicleModelQueryCondition vmqc = new VehicleModelQueryCondition();
List<VehicleModelVo> list = mapper.findVehicleModelPage(vmqc); List<VehicleModelVo> list = mapper.findVehicleModelPage(vmqc);
Set<VehicleModelVo> resultList = new HashSet<>(); Set<VehicleModelVo> resultList = new HashSet<>();
......
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