Commit 6ac0d95a authored by 周健威's avatar 周健威

用户信息接口、日价格接口

parent 32854f06
......@@ -59,6 +59,12 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
mapper.updateByExampleSelective(target, example);
}
/**
*
* @param where
* @param orderStr " crt_time desc "
* @return
*/
public List<T> selectByWeekend(Function<WeekendSqls<T>, WeekendSqls<T>> where, String orderStr) {
WeekendSqls whereSqls = where.apply(WeekendSqls.<T>custom());
Example.Builder builder = new Example.Builder(entityClass)
......
......@@ -31,11 +31,11 @@ public class BannerController {
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ObjectRestResponse findBannerlist(@RequestParam(value = "type" ,defaultValue = "0") Integer type,
public ObjectRestResponse findBannerlist(@RequestParam(required = false, value = "type") Integer type,
@RequestParam(required = false, value = "location") Integer location,
@RequestParam(required = false, value = "location") String multiLocation,
@RequestParam(required = false, value = "multiLocation") String multiLocation,
@RequestParam(value = "platform",required = false,defaultValue = "0") Integer platform) {
if (null == location || StrUtil.isBlank(multiLocation)) {
if (null == location && StrUtil.isBlank(multiLocation)) {
return ObjectRestResponse.createDefaultFail();
}
List<BannerVo> bannerList = bannerBiz.findBannerList(type, location, multiLocation, platform);
......
......@@ -19,7 +19,10 @@
</resultMap>
<select id="findBannerListByType" resultMap="bannerMap">
select * from `banner` where `is_del`=0 and `type`=#{type}
select * from `banner` where `is_del`=0
<if test="type != null">
and `type`=#{type}
</if>
<if test="location != null">
and `location`=#{location}
</if>
......
......@@ -20,7 +20,7 @@ public class VehicleBookInfo {
/**
* 预定信息所属年月(格式yyyy-MM)
*/
@Column(name = "year_month")
@Column(name = "`year_month`")
private String yearMonth;
/**
......
......@@ -495,12 +495,12 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@GetMapping(value = "/app/unauth/getDayCalendarPrice")
@IgnoreUserToken
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getDayCalendarPrice(DayCalendarDTO dto) {
public ObjectRestResponse<List<CalendarPriceChwDTO>> getDayCalendarPrice(DayCalendarDTO dto) {
return ObjectRestResponse.succ(getChwDayCalendarPrice(dto));
}
/**获取价格日历**/
public CalendarPriceChwDTO getChwDayCalendarPrice (DayCalendarDTO dto) {
public List<CalendarPriceChwDTO> getChwDayCalendarPrice (DayCalendarDTO dto) {
//根据时间获取预约记录 bookinfo
//转换为月份
String startMonth = StrUtil.subBefore(DateUtil.parseDateTime(dto.startDate).toDateStr(), "-", true);
......@@ -513,11 +513,9 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
.andLessThanOrEqualTo(VehicleBookInfo::getYearMonth, endMonth)
;
return w;
});
}, " `year_month` asc ");
List<CalendarPriceChwDTO> list2 = CollUtil.newArrayList();
CalendarPriceChwDTO calendarPriceChwDTO = new CalendarPriceChwDTO(){{
setDateStrs(CollUtil.newArrayList());
}};
list.forEach(info -> {
//月第一天
DateTime firstDay = DateUtil.parseDate(info.getYearMonth()+ "-01");
......@@ -527,18 +525,25 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
String monthStr = NumberUtil.getBinaryStr(info.getBookedDate());
for(int i = 0; i < monthDays; i++) {
if(i > monthStr.length() || StrUtil.equalsCharAt(monthStr, monthStr.length() - i - 1, '1')) {
calendarPriceChwDTO.getDateStrs().add(firstDay.offset(DateField.DAY_OF_MONTH, i).toDateStr());
int finalI = i;
CalendarPriceChwDTO calendarPriceChwDTO = new CalendarPriceChwDTO(){{
setDateStr(DateUtil.offsetDay(firstDay, finalI).toDateStr());
setAllowRent(SYS_FALSE);
}};
if(i > monthStr.length() || !StrUtil.equalsCharAt(monthStr, monthStr.length() - i - 1, '1')) {
calendarPriceChwDTO.setAllowRent(SYS_TRUE);
}
list2.add(calendarPriceChwDTO);
}
});
return calendarPriceChwDTO;
return list2;
}
@Data
public static class CalendarPriceChwDTO {
private List<String> dateStrs;
private String dateStr;
private Integer allowRent;
}
@Data
......
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