Commit 7c17254c authored by 周健威's avatar 周健威

Merge branch 'master-vehicle-price' into dev-tiande

# Conflicts:
#	xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderRentVehicleDetail.java
parents 92ad1908 953d5a9c
......@@ -35,4 +35,12 @@ public class CommonBaseController {
public String getCurrentUserId(){
return BaseContextHandler.getUserID();
}
public Integer getCurrentUserIdInt(){
if(null != BaseContextHandler.getUserID()) {
return Integer.valueOf(BaseContextHandler.getUserID());
}else {
return null;
}
}
}
......@@ -155,46 +155,12 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "出发公司Id")
private Integer startCompanyId;
@Column(name = "actual_end_company_id")
@ApiModelProperty(value = "实际结束公司id")
private Integer actualEndCompanyId;
@Column(name = "vehicle_company_id")
@ApiModelProperty(value = "出发公司Id")
private Integer vehicleCompanyId;
/**
* 结束公司Id
*/
@Column(name = "end_company_id")
@ApiModelProperty(value = "结束公司Id")
private Integer endCompanyId;
@Column(name = "start_branch_id")
@ApiModelProperty(value = "出发隶属的企业id")
private Integer startBranchId;
@Column(name = "actual_end_branch_id")
@ApiModelProperty(value = "实际结束隶属的企业id")
private Integer actualEndBranchId;
@Column(name = "vehicle_branch_id")
@ApiModelProperty(value = "车辆隶属企业id")
private Integer vehicleBranchId;
/**
* 结束公司Id
*/
@Column(name = "end_branch_id")
@ApiModelProperty(value = "结束隶属的企业id")
private Integer endBranchId;
/**
* 车型id
......@@ -395,6 +361,29 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "原结束时间")
private Long metaEndTime;
@Column(name = "start_branch_id")
@ApiModelProperty(value = "出发隶属的企业id")
private Long startBranchId;
@Column(name = "end_branch_id")
@ApiModelProperty(value = "结束隶属的企业id")
private Long endBranchId;
@Column(name = "actual_end_branch_id")
@ApiModelProperty(value = "实际结束隶属的企业id")
private Long actualEndBranchId;
@Column(name = "actual_end_company_id")
@ApiModelProperty(value = "实际结束公司id")
private Integer actualEndCompanyId;
@Column(name = "vehicle_branch_id")
@ApiModelProperty(value = "车辆隶属企业id")
private Long vehicleBranchId;
@Column(name = "vehicle_company_id")
@ApiModelProperty(value = "车辆公司(门店)id")
private Integer vehicleCompanyId;
public Long getEndTime() {
return endTime;
......
......@@ -315,6 +315,19 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(1001, restResponse.getMessage());
}
log.info("小程序订单还车成功: " + restResponse.getCode() + restResponse.getMessage());
//设置订单实际还车公司
CompanyDetail companyDetail = vehicleFeign.getCompanyDetail(vehicleArrivalVo.getArrivalBranchCompanyId()).getData();
//业务上先更新修改,业务解耦。
orderRentVehicleBiz.updateSelectiveById(new OrderRentVehicleDetail(){{
setId(orderRentVehicleDetail.getId());
setActualEndCompanyId(companyDetail.getId());
setActualEndBranchId(companyDetail.getCompanyId());
}});
//避免后续代码对 orderRentVehicleDetail 覆盖ActualEndCompanyId ActualEndBranchId
orderRentVehicleDetail.setActualEndCompanyId(companyDetail.getId());
orderRentVehicleDetail.setActualEndBranchId(companyDetail.getCompanyId());
} catch (Exception e) {
return ObjectRestResponse.createFailedResult(500, e.getMessage());
}
......
......@@ -33,10 +33,7 @@ import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.AccompanyingItemType;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleHolidayPriceInfo;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.RentVehicleBookDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
......@@ -128,7 +125,43 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//设置新增字段
//开始公司(门店)
// if(null != bo.getStartCompanyId())
if(null != bo.getStartCompanyId()) {
List<BranchCompany> companyDetails = vehicleFeign.branchCompanyEntityList(
BeanUtil.beanToMap(new BranchCompany(){{
setId(bo.getStartCompanyId());
}}, false, true)).getData();
if(null != companyDetails && companyDetails.size() > 0) {
bo.setStartBranchId(companyDetails.get(0).getCompanyId());
}
}
//结束公司(门店)
if(null != bo.getEndCompanyId()) {
List<BranchCompany> companyDetails = vehicleFeign.branchCompanyEntityList(
BeanUtil.beanToMap(new BranchCompany(){{
setId(bo.getEndCompanyId());
}}, false, true)).getData();
if(null != companyDetails && companyDetails.size() > 0) {
bo.setEndBranchId(companyDetails.get(0).getCompanyId());
}
}
//所属公司(门店)
if(null != bo.getVehicleId()) {
Vehicle vehicle = vehicleFeign.get(bo.getVehicleId()).getData();
bo.setVehicleCompanyId(vehicle.getSubordinateBranch());
List<BranchCompany> companyDetails = vehicleFeign.branchCompanyEntityList(
BeanUtil.beanToMap(new BranchCompany(){{
setId(bo.getVehicleCompanyId());
}}, false, true)).getData();
if(null != companyDetails && companyDetails.size() > 0) {
bo.setVehicleBranchId(companyDetails.get(0).getCompanyId());
}
}
}
public void initDictionary() {
......
......@@ -139,6 +139,10 @@ public class VehicleBookRecord {
@Column(name = "actual_end_date")
private Date actualEndDate;
public void setActualEndDate(Date actualEndDate) {
this.actualEndDate = actualEndDate;
}
/**
* 提车公司
*/
......
......@@ -59,6 +59,9 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty(hidden = true)
Boolean yearNo4Where;
@ApiModelProperty(hidden = true)
Integer withoutRecordWhere;
/**
* 是否根据预订记录(相交叉)查询
* 原(大于预约结束时间,小于预约开始时间的预约记录)
......
package com.xxfc.platform.vehicle.common;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -12,4 +13,24 @@ public class BaseController<Biz extends BaseBiz> {
protected HttpServletRequest request;
@Autowired
protected Biz baseBiz;
public HttpServletRequest getRequest() {
return request;
}
public String getCurrentUserName(){
return BaseContextHandler.getUsername();
}
public String getCurrentUserId(){
return BaseContextHandler.getUserID();
}
public Integer getCurrentUserIdInt(){
if(null != BaseContextHandler.getUserID()) {
return Integer.valueOf(BaseContextHandler.getUserID());
}else {
return null;
}
}
}
......@@ -133,6 +133,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
}
//设置显示是否有车(通过把时间与位比较从where移动到select)
//dto.setYearNo4Where(Boolean.TRUE);
//dto.setWithoutRecordWhere(SYS_TRUE);
//匹配相交叉的预约记录
dto.setRecordIntersection(Boolean.TRUE);
PageDataVO<UsableVehicleModelVO> uvmvpdvs = vehicleBiz.searchUsableModel(dto);
......
......@@ -646,6 +646,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
@RequestMapping(value = "/app/unauth/findById", method = RequestMethod.GET)
@IgnoreUserToken
public RestResponse<VehicleVO> appFindById(String id, String priceStartDate, String priceEndDate) {
Integer userId = getCurrentUserIdInt();
Vehicle vehicle = baseBiz.get(id);
VehicleVO vehicleVO = BeanUtil.toBean(vehicle, VehicleVO.class);
vehicleVO.setVehicleModel(vehicleModelBiz.selectById(vehicleVO.getModelId()));
......@@ -661,9 +662,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
}
if(StrUtil.isNotBlank(priceStartDate) && StrUtil.isNotBlank(priceEndDate)) {
vehicleVO.setPriceDTOS(vehicleHolidayPriceInfoBiz.getSynthesizePrice(vehicleVO.getId(), priceStartDate, priceEndDate, null, vehicleVO.getSubordinateBranch()));
vehicleVO.setPriceDTOS(vehicleHolidayPriceInfoBiz.getSynthesizePrice(vehicleVO.getId(), priceStartDate, priceEndDate, userId, vehicleVO.getSubordinateBranch()));
}else {
vehicleVO.setPriceDTOS(vehicleHolidayPriceInfoBiz.getSynthesizePrice(vehicleVO.getId(), DateUtil.today(), DateUtil.offsetDay(DateUtil.date(), 6).toDateStr(), null, vehicleVO.getSubordinateBranch()));
vehicleVO.setPriceDTOS(vehicleHolidayPriceInfoBiz.getSynthesizePrice(vehicleVO.getId(), DateUtil.today(), DateUtil.offsetDay(DateUtil.date(), 6).toDateStr(), userId, vehicleVO.getSubordinateBranch()));
}
return RestResponse.data(vehicleVO);
......
......@@ -53,10 +53,10 @@ public class VehicleHolidayPriceInfoController extends BaseController<VehicleHol
return baseBiz.deleteByVehicleId(vehicleId, festivalId);
}
@GetMapping(value = "multiCalendarPrice")
@GetMapping(value = "/app/unauth/multiCalendarPrice")
@IgnoreUserToken
public ObjectRestResponse<List<VehicleVO>> multiCalendarPrice(String vehicleIds, String startDate, String endDate) {
Integer userId = Integer.valueOf(getCurrentUserId());
Integer userId = getCurrentUserIdInt();
List<VehicleVO> vehicleVOS = CollUtil.newArrayList();
if(StrUtil.isNotBlank(vehicleIds)) {
......
......@@ -915,8 +915,13 @@
ifnull(vbi.bit_str = #{yearMonthAndParamBitStr}, false)
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle-->
<if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null ">
and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
<!-- and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})-->
<!-- and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})-->
and (
(IFNULL(abr.to_lift_company, v.park_branch_company_id) = #{startCompanyId})
and
(abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
)
</if>
)
) as hasVehicle
......@@ -952,32 +957,32 @@
</if>
)
<!-- union 所有下架车型 -->
<!-- -->
<!-- <if test="startCompanyId != null or parkBranchCompanyId != null ">-->
<!-- union-->
<!-- (select vm.id as model_id, bc.id as company_id-->
<!-- <if test=" catas != null ">-->
<!-- ,null as catas-->
<!-- </if>-->
<!-- <if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">-->
<!-- ,0 as hasVehicle-->
<!-- </if>-->
<!-- <if test="lon != null and lat != null">-->
<!-- &lt;!&ndash; 处理距离 &ndash;&gt;-->
<!-- ,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance-->
<!-- </if>-->
<!-- from vehicle_model vm-->
<!-- left join branch_company bc on-->
<!-- <choose>-->
<!-- <when test="startCompanyId != null">-->
<!-- bc.id = #{startCompanyId}-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- bc.id = #{parkBranchCompanyId}-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- where vm.isdel = 0 and vm.status = 0 and vm.app_show = 1)-->
<!-- </if>-->
<if test="startCompanyId != null or parkBranchCompanyId != null ">
union
(select vm.id as model_id, bc.id as company_id
<if test=" catas != null ">
,null as catas
</if>
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,0 as hasVehicle
</if>
<if test="lon != null and lat != null">
<!-- 处理距离 -->
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
from vehicle_model vm
left join branch_company bc on
<choose>
<when test="startCompanyId != null">
bc.id = #{startCompanyId}
</when>
<otherwise>
bc.id = #{parkBranchCompanyId}
</otherwise>
</choose>
where vm.isdel = 0 and vm.status = 1 and vm.app_show = 1)
</if>
<if test="lon != null and lat != null">
order by
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
......
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