Commit 8c66a7b4 authored by 周健威's avatar 周健威

Merge branch 'feature-24hour'

parents 6c1d788d 4cc8e261
......@@ -12,9 +12,12 @@ import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.DATE_TIME_LINE_FORMATTER;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.YMR_SLASH_FORMATTER;
@Data
public class AddRentVehicleDTO extends AddOrderCommonDTO{
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//开始时间
@ApiModelProperty(value = "开始时间")
......@@ -36,6 +39,18 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "预定目标日期(结束)", hidden = true)
private String bookEndDate;
/**
* 预定目标日期(开始)
*/
@ApiModelProperty(value = "预定目标时间(开始)", hidden = true)
private String bookStartDateTime;
/**
* 预定目标日期(结束)
*/
@ApiModelProperty(value = "预定目标时间(结束)", hidden = true)
private String bookEndDateTime;
//天数
@ApiModelProperty(value = "天数")
private Integer dayNum;
......@@ -111,12 +126,14 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
this.bookStartDate = YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
this.bookStartDateTime = DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
this.bookEndDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(endTime), ZoneOffset.ofHours(8)));
this.bookEndDate = YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(endTime), ZoneOffset.ofHours(8)));
this.bookEndDateTime = DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(endTime), ZoneOffset.ofHours(8)));
}
public void setAccompanyStrs(List<String> accompanyStrs) {
......
......@@ -121,7 +121,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
@Autowired
OrderCalculateBiz orderCalculateBiz;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
public List<OrderPageVO> pageByParm(Map<String, Object> paramMap) {
......@@ -226,34 +226,35 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
//获取两个日期之间的天数(包含头尾)
public int getDaysBetweenDateTimeHasStartEnd(DateTime startDay, DateTime endDay) {
int a = 0;
for (DateTime curDate = startDay; curDate.compareTo(endDay) <= 0; curDate = curDate.plusDays(1)) {
for (DateTime curDate = startDay; curDate.compareTo(endDay) <= 0; curDate = curDate.plusHours(1)) {
a++;
}
return a;
}
public static void main(String[] args) {
DateTime dateTime = DateTime.parse("2019-09-20", DEFAULT_DATE_TIME_FORMATTER);
DateTime dateTime1 = DateTime.parse("2019-09-22", DEFAULT_DATE_TIME_FORMATTER);
BaseOrderBiz baseOrderBiz = new BaseOrderBiz();
int a = baseOrderBiz.getDaysBetweenDateTimeHasStartEnd(dateTime,dateTime1) -1 ;
System.out.println(a);
}
// public static void main(String[] args) {
// DateTime dateTime = DateTime.parse("2019-09-20 12:00:00", DEFAULT_DATE_TIME_FORMATTER);
// DateTime dateTime1 = DateTime.parse("2019-09-22 12:00:00", DEFAULT_DATE_TIME_FORMATTER);
// BaseOrderBiz baseOrderBiz = new BaseOrderBiz();
// OrderCalculateBiz orderCalculateBiz = new OrderCalculateBiz();
// int a = orderCalculateBiz.getIncludeDays(1572246524350l,1572332924000l);
// System.out.println(a);
// }
public void updateCrossRefund(OrderPageVO orderPageVO) {
//计算延期费用
DedDetailDTO dedDetailDTO = new DedDetailDTO();
//提前还车,结束时间大于当前时间
DateTime nowTime = DateTime.parse(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime endTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getEndTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime startTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getStartTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
Long nowTime = System.currentTimeMillis();
Long endTime = orderPageVO.getOrderRentVehicleDetail().getEndTime();
Long startTime = orderPageVO.getOrderRentVehicleDetail().getStartTime();
//设置使用天数
int userUsedDay = getDaysBetweenDateTimeHasStartEnd(startTime, nowTime);
int userUsedDay = orderCalculateBiz.getIncludeDays(startTime, nowTime);
orderPageVO.getOrderRentVehicleDetail().setUsedDay(userUsedDay);
orderRentVehicleBiz.updateSelectiveById(orderPageVO.getOrderRentVehicleDetail());
//实际预定的天数
int actualDay = getDaysBetweenDateTimeHasStartEnd(startTime, endTime);
int actualDay = orderCalculateBiz.getIncludeDays(startTime, endTime);
Integer orderId = orderPageVO.getId();
List<OrderItem> items = orderItemBiz.selectList(new OrderItem() {{
setOrderId(orderId);
......@@ -272,15 +273,15 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/**
* 提前还车
*/
if (getDaysBetweenDateTimeHasStartEnd(endTime, nowTime) < 1) {
if (userUsedDay - actualDay < 0) {
StringBuilder stringBuilder = new StringBuilder();
//提前的天数, 当天就算使用一天
int noUsedDay = getDaysBetweenDateTimeHasStartEnd(nowTime, endTime) - 1;
int noUsedDay = actualDay - userUsedDay;
//退还未使用的天数,或者金额,扣除违约金,实际未使用天数的金额,最多3000元
// InProgressVO inProgressVO = new InProgressVO();
// inProgressVO.setViolateAmount(new BigDecimal(200));
// inProgressVO.setExtraAmount(new BigDecimal(200));
InProgressVO inProgressVO = orderCalculateBiz.inProgressCalculate(orderPageVO, actualDay - noUsedDay);
InProgressVO inProgressVO = orderCalculateBiz.inProgressCalculate(orderPageVO, userUsedDay);
if (inProgressVO != null) {
//消费超额金
if(inProgressVO.getExtraAmount() != null) {
......@@ -297,11 +298,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/**
* 延期还车
*/
} else if (getDaysBetweenDateTimeHasStartEnd(endTime, nowTime) > 1) {
} else if (userUsedDay - actualDay > 0) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("违约金( ¥");
//延期的天数, 延期违约金是延期天数*200%
int extraUsedDay = getDaysBetweenDateTimeHasStartEnd(endTime, nowTime) - 1;
int extraUsedDay = userUsedDay - actualDay;
if(extraUsedDay > 0) {
stringBuilder.append(amount);
stringBuilder.append(" x ");
......
......@@ -172,7 +172,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) {
boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime());
if (!flag) {
return ObjectRestResponse.createFailedResult(3502, "今日不是交车日期");
return ObjectRestResponse.createFailedResult(3502, "已超过预定还车时间,不能进行交车操作!");
}
if (null == userDTO.getCompanyId() || !userDTO.getCompanyId().equals(orderRentVehicleDetail.getStartCompanyId())) {
return ObjectRestResponse.createFailedResult(3501, "无交车权限");
......
......@@ -16,6 +16,8 @@ import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
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.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
......@@ -24,7 +26,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/**
* 订单退款记录表
......@@ -217,4 +223,32 @@ public class OrderCalculateBiz {
oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
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;
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;
}
}
\ No newline at end of file
......@@ -149,13 +149,7 @@ public class OrderCancelBiz {
//获取出发时间 到现在 距离时间
Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
if(timeLag < 0 ) {
//开始时间当天时间戳
Long beginOfStartDay = DateUtil.beginOfDay(DateUtil.date(orvd.getStartTime())).getTime();
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long useTimeLag = System.currentTimeMillis() - beginOfStartDay;
log.info("useTimeLag {}", new BigDecimal(useTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer useDays = new BigDecimal(useTimeLag + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ ""), 0, RoundingMode.UP).intValue();
Integer useDays = orderCalculateBiz.getIncludeDays(orvd.getStartTime(), System.currentTimeMillis());
inProgressVO = orderCalculateBiz.calculateOrderComplete(baseOrder, orvd, oad, orderItem, useDays, Boolean.TRUE);
//结合
//退款子流程: 订单基础,退款描述,退款金额
......@@ -324,6 +318,8 @@ public class OrderCancelBiz {
if(result < 0) {
throw new BaseException(ResultCode.FAILED_CODE);
}
orvd.setBackFreeDays(freeDays);
orderRentVehicleBiz.updateSelectiveById(orvd);
}
}else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
......
......@@ -54,7 +54,8 @@ import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
import static com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO.DEFAULT_DATE_TIME_FORMATTER;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.DATE_TIME_LINE_FORMATTER;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.YMR_SLASH_FORMATTER;
@Controller
@RequestMapping("baseOrder")
......@@ -338,8 +339,10 @@ public class BackStageOrderController extends CommonBaseController implements Us
RentVehicleBO bo = BeanUtil.toBean(orderPageVO.getOrderRentVehicleDetail(), RentVehicleBO.class);
bo.setOrder(orderPageVO);
bo.setBookVehicleVO(new BookVehicleVO(){{
setBookStartDate(DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDate(DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
}});
List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem(){{
......
......@@ -109,12 +109,25 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
String key = RENT_REFUND;
//违约金封顶 租车身份价 * 2天
BigDecimal topAmount = vehicleItem.getUnitPrice().multiply(new BigDecimal(2+ ""));
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(vehicleItem.getBuyAmount()
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
totalDeductAmount = deductionAmount;
deductionAmount = deductionAmount.setScale(2, RoundingMode.HALF_UP);
if(topAmount.compareTo(deductionAmount) > 0) {
totalDeductAmount = totalDeductAmount.add(deductionAmount);
topAmount = topAmount.subtract(deductionAmount);
}else {
totalDeductAmount = totalDeductAmount.add(topAmount);
deductionAmount = topAmount;
topAmount = BigDecimal.ZERO;
}
// totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString();
}
......
package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
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.auth.client.annotation.IgnoreClientToken;
......@@ -11,6 +12,7 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
......@@ -18,6 +20,9 @@ import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.add.BgAddRentDTO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.order.service.OrderRentVehicleService;
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.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
......@@ -26,19 +31,25 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Controller
@RequestMapping("orderRentVehicle")
@Api(value="租车订单",tags={"租车订单"})
@IgnoreClientToken
@Slf4j
public class OrderRentVehicleController extends CommonBaseController {
@Autowired
......@@ -56,6 +67,12 @@ public class OrderRentVehicleController extends CommonBaseController {
@Autowired
VehicleFeign vehicleFeign;
@Autowired
ThirdFeign thirdFeign;
@Autowired
OrderCalculateBiz orderCalculateBiz;
@RequestMapping(value = "add",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "确认租车订单")
......@@ -81,6 +98,9 @@ public class OrderRentVehicleController extends CommonBaseController {
}
private RentVehicleBO initRentVehicleBO(@RequestBody AddRentVehicleDTO vo) {
//计算天数
vo.setDayNum(orderCalculateBiz.getIncludeDays(vo.getStartTime(), vo.getEndTime()));
if(null == vo.getEndCompanyId() || vo.getEndCompanyId().equals(0)) {
if(StrUtil.isBlank(vo.getEndAddr())) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("公司参数不正确"));
......@@ -113,6 +133,8 @@ public class OrderRentVehicleController extends CommonBaseController {
bo.setBookVehicleVO(new BookVehicleVO(){{
setBookStartDate(vo.getBookStartDate());
setBookEndDate(vo.getBookEndDate());
setBookStartDateTime(vo.getBookStartDateTime());
setBookEndDateTime(vo.getBookEndDateTime());
}});
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())?
StrUtil.splitTrim(vo.getTickerNos(), ","):null);
......
......@@ -7,7 +7,6 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
......@@ -19,7 +18,6 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.pay.NotifyUrlDTO;
import com.xxfc.platform.order.pojo.price.OrderPriceVO;
import com.xxfc.platform.universal.entity.Dictionary;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -456,6 +456,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId());
rentVehicleBookDTO.setLiftAddr(detail.getStartAddr());
rentVehicleBookDTO.setRetCompany(detail.getEndCompanyId());
rentVehicleBookDTO.setStartCompanyId(detail.getStartCompanyId());
rentVehicleBookDTO.setEndCompanyId(detail.getEndCompanyId());
rentVehicleBookDTO.setOrderNo(detail.getOrder().getNo());
rentVehicleBookDTO.setNumberPlate(numberPlate);
rentVehicleBookDTO.setStatus(status);
......
......@@ -45,6 +45,7 @@ public class DictionaryKey {
public static final String DRIVER_PRICE ="DRIVER_PRICE";
public static final String DAMAGE_SAFE ="DAMAGE_SAFE";
public static final String ILLEGAL_RESERVE = "ILLEGAL_RESERVE";
public static final String RENT_TIME_BUFFER = "RENT_TIME_BUFFER";
/**
* 旅游:保险费用
......
......@@ -27,6 +27,18 @@ public class BookVehicleVO {
@ApiModelProperty("预定目标日期(结束)")
private String bookEndDate;
/**
* 预定目标日期(开始)
*/
@ApiModelProperty("预定目标时间(开始)")
private String bookStartDateTime;
/**
* 预定目标日期(结束)
*/
@ApiModelProperty("预定目标时间(结束)")
private String bookEndDateTime;
/**
* 取消预定目标日期(开始)
*/
......
......@@ -31,6 +31,19 @@ public class RentVehicleBookDTO extends PageParam {
@ApiModelProperty("预定目标日期(结束)")
private String bookEndDate;
/**
* 预定目标日期(开始)
*/
@ApiModelProperty("预定目标时间(开始)")
private String bookStartDateTime;
/**
* 预定目标日期(结束)
*/
@ApiModelProperty("预定目标时间(结束)")
private String bookEndDateTime;
/**
* 提车地点
*/
......
......@@ -54,8 +54,8 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty(hidden = true)
Boolean yearNo4Where;
@ApiModelProperty(hidden = true)
Integer withoutRecordWhere = 1;
// @ApiModelProperty(hidden = true)
// Integer withoutRecordWhere = 1;
/**
* 用途 1 租车
......
......@@ -320,9 +320,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
}
}
} else {
log.info("【修改车辆信息错误】》》》数据库车辆信息:{};前端传参车辆信息:{}", exitsVehicle.toString(), addOrUpdateVehicleVo.toString());
return RestResponse.codeAndMessage(ResCode.VEHICLE_INFO_SAME_NUM_PLATE_EXISTS.getCode(),
ResCode.VEHICLE_INFO_SAME_NUM_PLATE_EXISTS.getDesc());
}
// if(addOrUpdateVehicleVo.getCode()!= null &&
// addOrUpdateVehicleVo.getCode().equals(exitsVehicles.get(0).getCode())){
......
......@@ -195,14 +195,14 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
}
bookVehicleId = pageDataVO.getData().get(0).getId();
}
//判断是否为今天,如果是则设置为一分钟后开始
//判断是否为今天,如果是则设置为30秒后开始 防止预约开始时间比当前时间 要 前
if(DateUtil.today().equals(dto.getBookStartDate())) {
LocalDateTime ldt = LocalDateTime.ofInstant(Instant.ofEpochMilli(System.currentTimeMillis()), ZoneOffset.ofHours(8)).plusSeconds(30L);
dto.setBookStartDate(DateTimeFormatter.ofPattern(DATE_TIME_LINE).format(ldt));
}else {
dto.setBookStartDate(dto.getBookStartDate()+ " 00:00:00");
dto.setBookStartDate(dto.getBookEndDateTime());
}
dto.setBookEndDate(dto.getBookEndDate()+ " 23:59:59");
dto.setBookEndDate(dto.getBookEndDateTime());
BookVehicleVO bookVehicleVo = BeanUtil.toBean(dto, BookVehicleVO.class);
bookVehicleVo.setBookType(BookType.USER_RENT.getCode());
bookVehicleVo.setVehicleId(bookVehicleId);
......
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