Commit 9c9d6e86 authored by jiaorz's avatar jiaorz

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

parent abd5649a
package com.xxfc.platform.campsite.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -20,5 +21,6 @@ public interface CampsiteFeign {
@GetMapping(value = "/campsiteShop/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@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;
import com.alibaba.fastjson.JSONObject;
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.PageDataVO;
import com.xxfc.platform.campsite.dto.*;
......@@ -336,6 +338,28 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper, CampsiteShop> {
.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) {
return LocalDateTime.ofInstant(new Date(endTime).toInstant(), ZoneOffset.ofHours(+8))
......
......@@ -35,6 +35,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<GoodDataVO> findAll();
/**
* 根据店铺id查询
* @param id
......@@ -72,4 +74,6 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
* @return
*/
int checkNameExist(@Param("id") Integer id,@Param("name") String name);
}
......@@ -59,5 +59,10 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
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 @@
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</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查询详情-->
<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` ,
......
......@@ -104,4 +104,7 @@ public interface TourFeign {
@GetMapping("/spe/departure_date")
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> {
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
number = number == null ? 2 : number;
Map<String, Object> param = new HashMap<>();
List<TourGood> list = mapper.getCoordinateList(param);
Set<TourGood> resultList = new HashSet<>();
......
......@@ -39,6 +39,9 @@ public interface VehicleFeign {
@PostMapping("/active/small/arrival")
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)
public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score);
......
......@@ -78,7 +78,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
* @return
*/
public ObjectRestResponse findRandomVehicle(Integer number) {
number = number == null ? 3 : number;
number = number == null ? 2 : number;
VehicleModelQueryCondition vmqc = new VehicleModelQueryCondition();
List<VehicleModelVo> list = mapper.findVehicleModelPage(vmqc);
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