Commit eac6964c authored by 周健威's avatar 周健威

修改租车bug

parent 5931a53c
......@@ -54,6 +54,7 @@ public class UserAuthRestInterceptor extends HandlerInterceptorAdapter {
BaseContextHandler.setUsername(infoFromToken.getUniqueName());
BaseContextHandler.setName(infoFromToken.getName());
BaseContextHandler.setUserID(infoFromToken.getId());
BaseContextHandler.setToken(token);
// 这里可以添加RequestType
return super.preHandle(request, response, handler);
}
......
......@@ -64,4 +64,8 @@ public class AddTourDTO {
//站点id
@ApiModelProperty(value = "站点id")
private Integer siteId;
@Column(name = "has_insure")
@ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要")
Integer hasInsure;
}
package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderTourDetailBiz;
......@@ -29,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@RequestMapping("orderTour")
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.order.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
......@@ -115,7 +116,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
AppUserDTO dto = detail.getAppUserDTO();
//如果用户存在,并且为会员,并且车辆有优惠价
if(null != dto && detail.getRentFreeDay() > 0 && dto.getRentFreeDays() > 0) {
if(null != dto && null != detail.getRentFreeDay() && detail.getRentFreeDay() > 0 && dto.getRentFreeDays() > 0) {
if(detail.getDayNum() > dto.getRentFreeDays()) {
freeDayNum = dto.getRentFreeDays();
}else {
......@@ -132,11 +133,13 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//如果用户存在,并且为会员,并且车辆有优惠价
if(null != dto && !NONE.equals(detail.getAppUserDTO()) && !DISCOUNT_STATUS_NONE.equals(vehicleModel.getRentDiscountStatus())) {
String[] prices = vehicleModel.getRentDiscountPrice().split(",");
String[] prices = StrUtil.isBlank(vehicleModel.getRentDiscountPrice())
?new String[]{vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString()}
:vehicleModel.getRentDiscountPrice().split(",");
switch (MemberEnum.getByCode(detail.getAppUserDTO().getIsMember())) {
case NORMAL:
modelAmount = handleDiscount(vehicleModel, prices, NORMAL);
break;
break;
case GOLD:
modelAmount = handleDiscount(vehicleModel, prices, GOLD);
break;
......
......@@ -167,7 +167,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
TourSpePriceVo tourSpePriceVo = objectRestResponse.getData();
//需要保险
if(SYS_FALSE.equals(detail.getHasInsure())) {
if(SYS_TRUE.equals(detail.getHasInsure())) {
//人数 * 天数 * 价格
insureAmount = insureAmount.add(INSURE_PRICE.multiply(new BigDecimal(String.valueOf(detail.getTotalNumber() * detail.getTourGood().getNumber()))));
}
......
......@@ -935,7 +935,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
List<String> notBookedDates = Lists.newArrayList();
if(StringUtils.isNotBlank(dto.getBookEndDate())&&
StringUtils.isNotBlank(dto.getBookEndDate())) {
notBookedDates = convertDatePeriod2List(dto.getBookEndDate(),
notBookedDates = convertDatePeriod2List(dto.getBookStartDate(),
dto.getBookEndDate());
}
......
......@@ -389,7 +389,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
@RequestMapping(value = "/rent/book/vehicle", method = RequestMethod.POST)
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<String> rentApplyVehicle(@RequestBody RentVehicleBookDTO dto) throws Exception {
public ObjectRestResponse<VehicleBookRecord> rentApplyVehicle(@RequestBody RentVehicleBookDTO dto) throws Exception {
//默认USER_APP 预约
Integer operatorId = USER_APP;
String userName = dto.getUserName();
......@@ -405,9 +405,9 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
bookVehicleVo.setVehicleId(pageDataVO.getData().get(0).getId());
baseBiz.applyVehicle4Employee(operatorId, bookVehicleVo, userName);
VehicleBookRecord vehicleBookRecord = baseBiz.applyVehicle4Employee(operatorId, bookVehicleVo, userName);
return ObjectRestResponse.succ(bookVehicleVo.getVehicleId());
return ObjectRestResponse.succ(vehicleBookRecord);
}
......
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