Commit 8678fc07 authored by 周健威's avatar 周健威

修改申请

parent 71abd114
......@@ -228,5 +228,9 @@ public class ShuntApply implements Serializable {
@ApiModelProperty("型号名称")
private String categoryName;
@Column(name = "is_del")
private Integer isDel;
@Column(name = "is_bizdel")
private Integer isBizdel;
}
......@@ -58,7 +58,7 @@ public class OrderItemBiz extends BaseBiz<OrderItemMapper,OrderItem> {
Date overStart = DateUtil.offsetDay(endDate, 1);
Date overEnd = DateUtil.offsetDay(overStart, overDays);
// List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.findVehicleModelCalendarPriceByDate(overStart.getTime(), overEnd.getTime(), modelId, userId).getData();
List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.getPriceByVehicleIdFeignV2(vehicleId, overStart.toString(), overEnd.toString(), userId).getData();
List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.getPriceByVehicleIdFeignV2(vehicleId, overStart.getTime(), overEnd.getTime(), userId).getData();
for(VehicleModelCalendarPriceDTO vmcpd : overlist) {
overAmountList.add(BeanUtil.toBean(vmcpd, VMCalendarPriceCostDTO.class));
......
......@@ -30,6 +30,7 @@ import com.xxfc.platform.order.pojo.price.DelayAddPriceVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.inter.CalculateInterface;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.dto.order.VMCalendarPriceCostDTO;
......@@ -56,7 +57,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.*;
*/
@Slf4j
@Service
public class OrderCalculateBiz {
public class OrderCalculateBiz implements CalculateInterface {
@Autowired
UserFeign userFeign;
......@@ -85,6 +86,11 @@ public class OrderCalculateBiz {
@Autowired
OrderRentVehicleBiz orderRentVehicleBiz;
@Override
public ThirdFeign getThirdFeign() {
return thirdFeign;
}
public InProgressVO inProgressCalculate(BaseOrder baseOrder, VehicleItemDTO vehicleItemDTO, OrderRentVehicleDetail orvd, Integer useDays, OrderAccountDetail oad, Boolean isCancel) {
BigDecimal refundAmount = BigDecimal.ZERO;
BigDecimal consumeAmount = BigDecimal.ZERO;
......@@ -351,73 +357,73 @@ public class OrderCalculateBiz {
return inProgressVO;
}
/**
* 计算包含多少天
* @param startLong
* @param endLong
* @return
*/
public Integer getIncludeDays(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
Long dayLong = hourLong * 24;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了一天
if(bookTimeLag <= 0) {
return 1;
}
log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%dayLong;
if(excess > bufferLong) {
bookDays += 1;
}
if(0 == bookDays) {
bookDays = 1;
}
return bookDays;
}
/**
* 计算包含多少小时
* @param startLong
* @param endLong
* @return
*/
public Integer getIncludeHours(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
//Long dayLong = hourLong * 24;
Long bufferLong = 0L;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了1小时
if(bookTimeLag <= 0) {
return 1;
}
log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
log.info("divide {}", new BigDecimal(hourLong+ ""));
Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%hourLong;
if(excess > bufferLong) {
hourDays += 1;
}
if(0 == hourDays) {
hourDays = 1;
}
return hourDays;
}
// /**
// * 计算包含多少天
// * @param startLong
// * @param endLong
// * @return
// */
// public Integer getIncludeDays(Long startLong, Long endLong) {
// Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
// Long hourLong = (60L * 60L * 1000L);
// Long dayLong = hourLong * 24;
// Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//
// //计算:使用天数 当前时间 - 开始时间的0时0分0秒
// Long bookTimeLag = endLong - startLong;
//
// //默认 已使用了一天
// if(bookTimeLag <= 0) {
// return 1;
// }
//
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
// Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong+ ""), 0, RoundingMode.DOWN).intValue();
// Long excess = bookTimeLag%dayLong;
// if(excess > bufferLong) {
// bookDays += 1;
// }
//
// if(0 == bookDays) {
// bookDays = 1;
// }
// return bookDays;
// }
//
// /**
// * 计算包含多少小时
// * @param startLong
// * @param endLong
// * @return
// */
// public Integer getIncludeHours(Long startLong, Long endLong) {
// Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
// Long hourLong = (60L * 60L * 1000L);
// //Long dayLong = hourLong * 24;
// Long bufferLong = 0L;
//
// //计算:使用天数 当前时间 - 开始时间的0时0分0秒
// Long bookTimeLag = endLong - startLong;
//
// //默认 已使用了1小时
// if(bookTimeLag <= 0) {
// return 1;
// }
//
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal(hourLong+ ""));
// Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
// Long excess = bookTimeLag%hourLong;
// if(excess > bufferLong) {
// hourDays += 1;
// }
//
// if(0 == hourDays) {
// hourDays = 1;
// }
// return hourDays;
// }
public OrderRefundPriceVO getPriceCalculate (String no, OrderPageVO orderPageVO) {
//根据no 查订单
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
......@@ -98,8 +99,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
// if(null != shuntApply.getCategoryId()) {
// VehicleCategory vehicleCategory = vehicleFeign.getVehicleCategory(shuntApply.getCategoryId()).getData();
// shuntApply.setCategoryName(vehicleCategory.getName());
// }else if{
//
// }
shuntApply.setUserId(getCurrentUserIdInt());
......@@ -141,13 +140,12 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
Query query = new Query(dto);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(ShuntApply::getUserId, dto.getUserId());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
return w;
}, " crt_time desc "), ShuntApplyVO.class);
// pages.getData().forEach(data -> {
// if(null != data.getCategoryId()) {
// data.setVehicleCategory(vehicleFeign.getVehicleCategory(data.getCategoryId()).getData());
// }
// });
pages.getData().forEach(data -> {
data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData());
});
return ObjectRestResponse.succ(pages);
}
......@@ -203,6 +201,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
OrderPageVO orderPageVO;
VehicleCategory vehicleCategory;
VehicleBrand vehicleBrand;
AppUserDTO appUserDTO;
}
@Data
......@@ -227,16 +226,15 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
PageDataVO<StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
if(null != dto.getCityCode()) {
w.andEqualTo(ShuntApply::getStartCityCode, dto.getCityCode());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
}
w.andEqualTo(ShuntApply::getStatus, STATUS_CRT);
return w;
}, " crt_time desc "), StewardShuntApply.class);
// list.getData().forEach(data -> {
// if(null != data.getCategoryId()) {
// data.setVehicleCategory(vehicleFeign.getVehicleCategory(data.getCategoryId()).getData());
// }
// });
list.getData().forEach(data -> {
data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData());
});
return ObjectRestResponse.succ(list);
}
......@@ -304,6 +302,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
Integer companyId = userDTO.getCompanyId();
ShuntApply shuntApply = baseBiz.selectById(applyId);
StewardShuntApply shuntApplyVO = BeanUtil.toBean(shuntApply, StewardShuntApply.class);
shuntApplyVO.setAppUserDTO(userFeign.userDetailById(shuntApplyVO.getUserId()).getData());
RentVehicleBookDTO rbd = new RentVehicleBookDTO();
//rbd.setModelId(shuntApply.getModelId());
rbd.setBrandId(shuntApply.getBrandId());
......@@ -356,6 +355,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
w.andEqualTo(ShuntApply::getConfirmUserId, userDTO.getId());
if(StrUtil.isNotBlank(dto.getMultiStatus())) {
w.andIn(ShuntApply::getStatus, CollUtil.toList(dto.getMultiStatus().split(",")));
w.andEqualTo(ShuntApply::getIsBizdel, SYS_FALSE);
}
return w;
}), ShuntApplyController.ShuntApplyVO.class);
......@@ -400,5 +400,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
List<UsableVeicleVO> vehicles;
VehicleCategory vehicleCategory;
VehicleBrand vehicleBrand;
AppUserDTO appUserDTO;
}
}
\ No newline at end of file
......@@ -403,7 +403,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
Vehicle vehicle = detail.getVehicle();
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartDateStr(), detail.getEndDateStr(), dto.getUserid()).getData();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartTime(), detail.getEndTime(), dto.getUserid()).getData();
List<VMCalendarPriceCostDTO> vmcpds = Convert.toList(VMCalendarPriceCostDTO.class, metaVmcpds);
......@@ -589,7 +589,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
Vehicle vehicle = detail.getVehicle();
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartDateStr(), detail.getEndDateStr(), dto.getUserid()).getData();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartTime(), detail.getEndTime(), dto.getUserid()).getData();
List<VMCalendarPriceCostDTO> vmcpds = Convert.toList(VMCalendarPriceCostDTO.class, metaVmcpds);
......
package com.xxfc.platform.universal.inter;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
public interface CalculateInterface {
public ThirdFeign getThirdFeign();
/**
* 计算包含多少天
* @param startLong
* @param endLong
* @return
*/
default Integer getIncludeDays(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = getThirdFeign().dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
Long dayLong = hourLong * 24;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了一天
if(bookTimeLag <= 0) {
return 1;
}
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%dayLong;
if(excess > bufferLong) {
bookDays += 1;
}
if(0 == bookDays) {
bookDays = 1;
}
return bookDays;
}
/**
* 计算包含多少小时
* @param startLong
* @param endLong
* @return
*/
default Integer getIncludeHours(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = getThirdFeign().dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
//Long dayLong = hourLong * 24;
Long bufferLong = 0L;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了1小时
if(bookTimeLag <= 0) {
return 1;
}
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal(hourLong+ ""));
Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%hourLong;
if(excess > bufferLong) {
hourDays += 1;
}
if(0 == hourDays) {
hourDays = 1;
}
return hourDays;
}
}
......@@ -243,7 +243,7 @@ public interface VehicleFeign {
@GetMapping(value = "/vehicleInfo/v2/getPriceByVehicleFeign")
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getPriceByVehicleIdFeignV2(
@RequestParam("vehicleId") String vehicleId, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("userId") Integer userId);
@RequestParam("vehicleId") String vehicleId, @RequestParam("startDateTemp") Long startDateTemp, @RequestParam("endDateTemp") Long endDateTemp, @RequestParam("userId") Integer userId);
@RequestMapping(value = "/vehicleInfo/selectByParam", method = RequestMethod.GET)
public RestResponse<List<Vehicle>> vehicleSelectByParam(@RequestParam(value = "vehicle")Map<String, Object> vehicleMap);
......
......@@ -8,6 +8,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.inter.CalculateInterface;
import com.xxfc.platform.vehicle.entity.VehicleModelCalendarPrice;
import com.xxfc.platform.vehicle.mapper.VehicleModelCalendarPriceMapper;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
......@@ -48,7 +49,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPriceMapper, VehicleModelCalendarPrice> {
public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPriceMapper, VehicleModelCalendarPrice> implements CalculateInterface {
private static final int START_OF_WEEK = 1;
private static final int END_OF_WEEK = 7;
private static final Integer DEFAULT_DISCOUNT = 100;
......@@ -63,6 +64,10 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
private final UserFeign userFeign;
private final ThirdFeign thirdFeign;
@Override
public ThirdFeign getThirdFeign() {
return thirdFeign;
}
/**
* 保存
......@@ -233,40 +238,74 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
return vehicleModelCalendarPrice;
}
/**
* 计算包含多少天
*
* @param startLong
* @param endLong
* @return
*/
private Integer getIncludeDays(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
Long dayLong = hourLong * 24;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了一天
if(bookTimeLag <= 0) {
return 1;
}
log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000) + ""));
Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong + ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag % dayLong;
if (excess > bufferLong) {
bookDays += 1;
}
if (0 == bookDays) {
bookDays = 1;
}
return bookDays;
}
// /**
// * 计算包含多少天
// *
// * @param startLong
// * @param endLong
// * @return
// */
// private Integer getIncludeDays(Long startLong, Long endLong) {
// Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
// Long hourLong = (60L * 60L * 1000L);
// Long dayLong = hourLong * 24;
// Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//
// //计算:使用天数 当前时间 - 开始时间的0时0分0秒
// Long bookTimeLag = endLong - startLong;
//
// //默认 已使用了一天
// if(bookTimeLag <= 0) {
// return 1;
// }
//
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000) + ""));
// Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong + ""), 0, RoundingMode.DOWN).intValue();
// Long excess = bookTimeLag % dayLong;
// if (excess > bufferLong) {
// bookDays += 1;
// }
//
// if (0 == bookDays) {
// bookDays = 1;
// }
// return bookDays;
// }
//
// /**
// * 计算包含多少小时
// * @param startLong
// * @param endLong
// * @return
// */
// public Integer getIncludeHours(Long startLong, Long endLong) {
// Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
// Long hourLong = (60L * 60L * 1000L);
// //Long dayLong = hourLong * 24;
// Long bufferLong = 0L;
//
// //计算:使用天数 当前时间 - 开始时间的0时0分0秒
// Long bookTimeLag = endLong - startLong;
//
// //默认 已使用了1小时
// if(bookTimeLag <= 0) {
// return 1;
// }
//
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal(hourLong+ ""));
// Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
// Long excess = bookTimeLag%hourLong;
// if(excess > bufferLong) {
// hourDays += 1;
// }
//
// if(0 == hourDays) {
// hourDays = 1;
// }
// return hourDays;
// }
/**
* 价格24小时处理
......
......@@ -16,6 +16,8 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.inter.CalculateInterface;
import com.xxfc.platform.vehicle.biz.*;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.RestResponse;
......@@ -55,7 +57,7 @@ import static com.xxfc.platform.vehicle.constant.VehicleConstant.USER_APP_NAME;
@Slf4j
@IgnoreClientToken
@Api(value="租车相关车辆管理controller",tags={"租车相关车辆管理接口"})
public class RentVehicleController extends BaseController<VehicleBiz> implements UserRestInterface {
public class RentVehicleController extends BaseController<VehicleBiz> implements UserRestInterface, CalculateInterface {
private static final Integer DEFAULT_DISCOUNT = 100;
private static final Integer DEFAULT_MEMBER_LEVEL = 0;
private static final Integer DEFAULT_MEMBER_TYPE = 0;
......@@ -69,6 +71,9 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@Autowired
UserFeign userFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired
VehicleBiz vehicleBiz;
......@@ -81,6 +86,12 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@Autowired
VehicleHolidayPriceInfoBiz vehicleHolidayPriceInfoBiz;
@Override
public ThirdFeign getThirdFeign() {
return thirdFeign;
}
public UserFeign getUserFeign() {
return userFeign;
}
......@@ -406,26 +417,46 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
@GetMapping(value = "/app/unauth/v2/getPriceByVehicle")
@IgnoreUserToken
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getByVehicleIdV2(String vehicleId, String startDate, String endDate, Long startDateTemp, Long endDateTemp) {
if(null != startDateTemp) {
startDate = DateUtil.date(startDateTemp).toString();
}
if(null != endDateTemp) {
endDate = DateUtil.date(endDateTemp).toString();
}
return ObjectRestResponse.succ(getSynthesizePrice(vehicleId, startDate, endDate, getCurrentUserIdInt()));
// if(null != startDateTemp) {
// startDate = DateUtil.date(startDateTemp).toString();
// }
// if(null != endDateTemp) {
// endDate = DateUtil.date(endDateTemp).toString();
// }
return ObjectRestResponse.succ(getSynthesizePrice(vehicleId, startDateTemp, endDateTemp, getCurrentUserIdInt()));
}
@GetMapping(value = "v2/getPriceByVehicleFeign")
@IgnoreUserToken
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getByVehicleIdFeignV2(String vehicleId, String startDate, String endDate, Integer userId) {
return ObjectRestResponse.succ(getSynthesizePrice(vehicleId, startDate, endDate, userId));
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getByVehicleIdFeignV2(String vehicleId, Long startDateTemp, Long endDateTemp, Integer userId) {
List<VehicleModelCalendarPriceDTO> list = getSynthesizePrice(vehicleId, startDateTemp, endDateTemp, userId);
Vehicle vehicle = vehicleBiz.selectOne(new Vehicle(){{
setId(vehicleId);
}});
List<VehicleModelCalendarPriceDTO> list2 = CollUtil.newArrayList();
if(list.size() > 0) {
Integer cycle = 0;
if(Vehicle.PRICE_TYPE_HOUR == vehicle.getPriceType()) {
cycle = getIncludeHours(startDateTemp, endDateTemp);
}else {
cycle = getIncludeDays(startDateTemp, endDateTemp);
}
for(int i = 0; i < cycle; i++) {
list2.add(list.get(i));
}
}
return ObjectRestResponse.succ(list2);
}
public List<VehicleModelCalendarPriceDTO> getSynthesizePrice (String vehicleId, String startDate, String endDate, Integer userId) {
public List<VehicleModelCalendarPriceDTO> getSynthesizePrice (String vehicleId, Long startDateTemp, Long endDateTemp, Integer userId) {
List<VehicleModelCalendarPriceDTO> priceDTOS = CollUtil.newArrayList();
String startDate = DateUtil.date(startDateTemp).toString();
String endDate = DateUtil.date(endDateTemp).toString();
cn.hutool.core.date.DateTime beginOfStartDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
cn.hutool.core.date.DateTime endOfEndDate = DateUtil.endOfDay(DateUtil.parse(endDate));
//获取基本和周末价格
//获取基本和周末价格company_info
Vehicle vehicle = vehicleBiz.selectOne(new Vehicle(){{
setId(vehicleId);
}});
......
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