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

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

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