Commit b442f72d authored by libin's avatar libin

Merge branch 'dev' into lb_dev

parents 4e23d593 abd5649a
......@@ -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)));
......
......@@ -542,6 +542,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
VehicleBookHourInfoDto vehicleBookHourInfoDto = new VehicleBookHourInfoDto();
vehicleBookHourInfoDto.setYearMonthDay(entry.getKey());
vehicleBookHourInfoDto.setVehicleId(vehicleId);
if(entry.getValue() == 0) {//0点 查询是否有已经预约的记录
Map<String, Object> param = new HashMap<>();
param.put("vehicleId", vehicleId);
param.put("bookedEndDate", DateTime.parse(entry.getKey() + " 00:00:00", DATE_TIME_FORMATTER));
List<VehicleBookRecordVo> vehicleBookRecordVos = vehicleBookRecordBiz.selectZeroHourRecord(param);
if(vehicleBookRecordVos != null && vehicleBookRecordVos.size() > 0) {
return false;
}
}
List<VehicleBookHourInfo> vehicleBookHourInfos = vehicleBookHourInfoBiz.selectByVehicleAndDate(vehicleBookHourInfoDto);
if(vehicleBookHourInfos != null && vehicleBookHourInfos.size() > 0) {
if((vehicleBookHourInfos.get(0).getBookedHour() & entry.getValue()) != 0) { // 已经被预定
......
......@@ -93,6 +93,12 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
return list;
}
public List<VehicleBookRecordVo> selectZeroHourRecord(Map<String, Object> param) {
List<VehicleBookRecordVo> list = mapper.selectZeroHourRecord(param);
removeStatus2(list);
return list;
}
public int changeRecordStatus(Map<String, Object> updateParam) {
return mapper.changeRecordStatus(updateParam);
}
......
......@@ -37,4 +37,7 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> {
public List<VehicleBookRecordVo> getBookRecordInfo(Map<String, Object> param);
public List<VehicleBookRecordVo> selectByVehicleIdAndTime(Map<String, Object> param);
public List<VehicleBookRecordVo> selectZeroHourRecord(Map<String, Object> param);
}
\ No newline at end of file
......@@ -330,6 +330,13 @@
where v1.vehicle_id = #{vehicleId} and v1.book_end_date &lt;= #{bookedEndDate} and v1.status BETWEEN 1 and 2
</select>
<select id="selectZeroHourRecord" resultMap="searchBookRecord" parameterType="java.util.Map">
select v1.* from vehicle_book_record v1
where v1.vehicle_id = #{vehicleId}
and (v1.book_end_date = #{bookedEndDate} or v1.book_start_date = #{bookedEndDate})
and v1.status BETWEEN 1 and 2
</select>
<select id="getById" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord">
select
vbr.`id`,
......
......@@ -522,11 +522,17 @@
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,max(
,(max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
) as hasVehicle
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 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,15 +641,16 @@
</foreach>
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<!-- 根据前后record 过滤车辆 -->
<if test="startCompanyId != null and endCompanyId != null ">
<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}
</if>
......
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