Commit b1b180c9 authored by hezhen's avatar hezhen

Merge branch 'dev' into hz_dev

# Conflicts:
#	xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/mapper/CampsiteShopMapper.java
#	xx-campsite/xx-campsite-server/src/main/java/com/xxfc/platform/campsite/rest/CampsiteShopController.java
parents 73e9499b 3040c163
......@@ -16,7 +16,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
server-addr: 127.0.0.1:8848,10.1.37.166:8848
#共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
---
......
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.*;
......@@ -330,6 +332,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))
......
......@@ -39,6 +39,8 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<GoodDataVO> findAll();
/**
* 根据店铺id查询
*
......@@ -80,5 +82,11 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
* @param name
* @return
*/
<<<<<<< HEAD
int checkNameExist(@Param("id") Integer id, @Param("name") String name);
=======
int checkNameExist(@Param("id") Integer id,@Param("name") String name);
>>>>>>> dev
}
......@@ -60,11 +60,18 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return getBaseBiz().getAllByHome(page,limit);
}
<<<<<<< HEAD
@PostMapping(value = "/app/unauth/webchat_official/campsites")
public ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsitesForPublicNumber(@RequestBody CampsiteShopFindDTO campsiteShopFindDTO){
PageDataVO<CampsiteShopPageVo> campsiteShops = baseBiz.findCampsiteShopPageByType(campsiteShopFindDTO);
return ObjectRestResponse.succ(campsiteShops);
=======
@ApiOperation("随机获取营地")
@GetMapping(value = "/app/unauth/findRandomVehicle")
public ObjectRestResponse findRandomVehicle(Integer number) {
return baseBiz.findRandomVehicle(number);
>>>>>>> dev
}
}
\ No newline at end of file
......@@ -63,6 +63,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<>();
......
......@@ -100,7 +100,7 @@
LEFT JOIN tour_good_site s on v.site_id=s.id
LEFT JOIN tour_good_spe_price p ON v.spe_id=p.id
WHERE
v.is_del = 0 and v.good_id=#{goodId} and DATEDIFF(p.start_time,NOW())>0
v.is_del = 0 and v.good_id=#{goodId} <!--and DATEDIFF(p.start_time,NOW())>0-->
<if test="siteId!=null and siteId!='' ">
and v.site_id=#{siteId}
</if>
......
......@@ -69,3 +69,5 @@ public class DictionaryController {
return ObjectRestResponse.succ();
}
}
......@@ -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);
......
......@@ -54,6 +54,9 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty(hidden = true)
Boolean yearNo4Where;
@ApiModelProperty(hidden = true)
Integer withoutRecordWhere = 1;
public void setStartDateTamp(Long startDateTamp) {
this.startDateTamp = startDateTamp;
this.startDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTamp), ZoneOffset.ofHours(8)));
......
......@@ -70,19 +70,24 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
endPredictableHour |= 1 << (curentHour);
}
}
DateTime startDay = DateTime.parse(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
if(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER).equals(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER))) {//同一天预定
//如果开始时间是0点开始
if(startPredictableHour == 0 || endPredictableHour == 0) {
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour | endPredictableHour);
} else {
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour & endPredictableHour);
}
} else {
} else { //非同一天开始
if(startPredictableHour == 0) { //如果是0点就直接预订全天
startPredictableHour = 16777215;
}
predictableHours.put(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), startPredictableHour);
predictableHours.put(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), endPredictableHour);
}
DateTime startDay = DateTime.parse(DateTime.parse(bookStartDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
DateTime endDay = DateTime.parse(DateTime.parse(bookEndDate, DEFAULT_DATE_TIME_FORMATTER).toString(DATE_TIME_FORMATTER), DATE_TIME_FORMATTER);
if(endDay.getDayOfMonth() - startDay.getDayOfMonth() >1){ //
if(endDay.getDayOfMonth() - startDay.getDayOfMonth() > 1){ //
for (DateTime curDate = startDay.plusDays(1); curDate.compareTo(endDay) < 0; curDate = curDate.plusDays(1)) {
String curDateStr = curDate.toString(DATE_TIME_FORMATTER);
//全天预定
......
......@@ -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<>();
......
......@@ -23,7 +23,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
server-addr: 127.0.0.1:8848,10.1.37.166:8848
#共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
......
......@@ -522,11 +522,17 @@
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
) as hasVehicle
,(max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle-->
<if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null ">
and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
</if>
)
)as hasVehicle
</if>
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
......@@ -557,7 +563,7 @@
) > 0
</if>
)
<!-- union 所有车型 -->
<!-- union 所有下架车型 -->
<if test="startCompanyId != null or parkBranchCompanyId != null ">
union
(select vm.id as model_id, bc.id as company_id
......@@ -635,14 +641,15 @@
</foreach>
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<!-- 根据前后record 过滤车辆 -->
<if test="startCompanyId != null and endCompanyId != null ">
and (
<if test="withoutRecordWhere == null">
and (
(abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and
(abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
)
)
</if>
</if>
<if test=" modelId != null ">
and v.model_id = #{modelId}
......
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