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

添加申请调车

parent 9a80a78a
...@@ -9,7 +9,7 @@ import lombok.Data; ...@@ -9,7 +9,7 @@ import lombok.Data;
/** /**
* 调车申请 * 调车申请
* *
* @author libin * @author libin
* @email 18178966185@163.com * @email 18178966185@163.com
* @date 2020-09-09 14:49:51 * @date 2020-09-09 14:49:51
...@@ -25,117 +25,127 @@ public class ShuntApply implements Serializable { ...@@ -25,117 +25,127 @@ public class ShuntApply implements Serializable {
public static final int STATUS_CONFIRM = 3; public static final int STATUS_CONFIRM = 3;
public static final int STATUS_ORDER = 4; public static final int STATUS_ORDER = 4;
public static final int STATUS_AUTOCNL = 5; public static final int STATUS_AUTOCNL = 5;
public static final int STATUS_ERR = 6;
/** public static final int STATUS_SUCC = 7;
* 主键
*/ public static final int ORDER_STATUS_TOPAY = 1;
@Id public static final int ORDER_STATUS_PAY = 2;
public static final int ORDER_STATUS_CANCEL = 3;
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键") @ApiModelProperty("主键")
private Integer id; private Integer id;
/** /**
* 状态 * 状态
0--删除 0--删除
1--创建 1--创建
2--取消 2--取消
3--申请成功 3--申请成功
*/ */
@Column(name = "status") @Column(name = "status")
@ApiModelProperty(value = "状态 0--删除 1--创建 2--取消 3--申请成功 ") @ApiModelProperty(value = "状态 0--删除 1--创建 2--取消 3--接单中 4--已下单 5--接单成功 6--接单失败")
private Integer status; private Integer status;
/** @Column(name = "order_status")
* 创建时间 @ApiModelProperty(value = "状态 1--待支付 2--已支付 3--已取消 ")
*/ private Integer orderStatus;
@Column(name = "crt_time")
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true ) @ApiModelProperty(value = "创建时间", hidden = true )
private Date crtTime; private Date crtTime;
/** /**
* 创建者id * 创建者id
*/ */
@Column(name = "crt_user") @Column(name = "crt_user")
@ApiModelProperty(value = "创建者id") @ApiModelProperty(value = "创建者id")
private String crtUser; private String crtUser;
/** /**
* 用户id * 用户id
*/ */
@Column(name = "user_id") @Column(name = "user_id")
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private Integer userId; private Integer userId;
/** /**
* 更新者id * 更新者id
*/ */
@Column(name = "upd_user") @Column(name = "upd_user")
@ApiModelProperty(value = "更新者id") @ApiModelProperty(value = "更新者id")
private String updUser; private String updUser;
/** /**
* 更新时间 * 更新时间
*/ */
@Column(name = "upd_time") @Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true ) @ApiModelProperty(value = "更新时间", hidden = true )
private Date updTime; private Date updTime;
/** /**
* 开始公司 * 开始公司
*/ */
@Column(name = "start_company_id") @Column(name = "start_company_id")
@ApiModelProperty(value = "开始公司") @ApiModelProperty(value = "开始公司")
private Integer startCompanyId; private Integer startCompanyId;
/** /**
* 结束公司 * 结束公司
*/ */
@Column(name = "end_company_id") @Column(name = "end_company_id")
@ApiModelProperty(value = "结束公司") @ApiModelProperty(value = "结束公司")
private Integer endCompanyId; private Integer endCompanyId;
/** /**
* 车型id * 车型id
*/ */
@Column(name = "model_id") @Column(name = "model_id")
@ApiModelProperty(value = "车型id") @ApiModelProperty(value = "车型id")
private Integer modelId; private Integer modelId;
/** /**
* 车辆id * 车辆id
*/ */
@Column(name = "vehicle_id") @Column(name = "vehicle_id")
@ApiModelProperty(value = "车辆id") @ApiModelProperty(value = "车辆id")
private String vehicleId; private String vehicleId;
/** /**
* 开始时间 * 开始时间
*/ */
@Column(name = "start_time") @Column(name = "start_time")
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
private Long startTime; private Long startTime;
/** /**
* 结束时间 * 结束时间
*/ */
@Column(name = "end_time") @Column(name = "end_time")
@ApiModelProperty(value = "结束时间") @ApiModelProperty(value = "结束时间")
private Long endTime; private Long endTime;
/** /**
* 订单id * 订单id
*/ */
@Column(name = "order_id") @Column(name = "order_id")
@ApiModelProperty(value = "订单id") @ApiModelProperty(value = "订单id")
private Integer orderId; private Integer orderId;
/** /**
* 订单编号 * 订单编号
*/ */
@Column(name = "order_no") @Column(name = "order_no")
@ApiModelProperty(value = "订单编号") @ApiModelProperty(value = "订单编号")
private String orderNo; private String orderNo;
/** /**
* 开始公司名称 * 开始公司名称
...@@ -158,4 +168,41 @@ public class ShuntApply implements Serializable { ...@@ -158,4 +168,41 @@ public class ShuntApply implements Serializable {
@ApiModelProperty(value = "超时时间戳", hidden = true ) @ApiModelProperty(value = "超时时间戳", hidden = true )
private Long overTime; private Long overTime;
/**
* 开始城市编码
*/
@Column(name = "start_city_code")
@ApiModelProperty(value = "开始城市编码")
private Integer startCityCode;
/**
* 结束城市编码
*/
@Column(name = "end_city_code")
@ApiModelProperty(value = "结束城市编码", hidden = true )
private Integer endCityCode;
/**
* 确认申请的后台用户id
*/
@Column(name = "confirm_user_id")
@ApiModelProperty(value = "确认申请的后台用户id", hidden = true )
private Integer confirmUserId;
/**
* 确认申请的公司(门店)id
*/
@Column(name = "confirm_company_id")
@ApiModelProperty(value = "确认申请的公司(门店)id", hidden = true )
private Integer confirmCompanyId;
/**
* 预约记录id
*/
@Column(name = "book_record_id")
@ApiModelProperty(value = "预约记录id", hidden = true )
private Long bookRecordId;
} }
...@@ -22,6 +22,12 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail ...@@ -22,6 +22,12 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
private BaseOrder order; private BaseOrder order;
private VehicleModel vehicleModel; private VehicleModel vehicleModel;
private BookVehicleVO bookVehicleVO; private BookVehicleVO bookVehicleVO;
/**
* 是否调车申请下订单
*/
private Integer applyOrderSign = 0;
/** /**
* 是否使用出租免费天数 * 是否使用出租免费天数
*/ */
......
...@@ -5,6 +5,7 @@ import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFacto ...@@ -5,6 +5,7 @@ import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFacto
import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory; import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -23,44 +24,69 @@ public class RabbitDelayConfig { ...@@ -23,44 +24,69 @@ public class RabbitDelayConfig {
public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange"; public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange";
public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue"; public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue";
public static final String ORDER_CANCEL_KEY = "order_cancel_delay_key"; public static final String ORDER_CANCEL_KEY = "order_cancel_delay_key";
public static final String APPLY_CANCEL_EXC = "apply_cancel_delay_exchange";
public static final String APPLY_CANCEL_QUE = "apply_cancel_delay_queue";
public static final String APPLY_CANCEL_KEY = "apply_cancel_delay_key";
/** /**
* 延时队列交换机 * 延时队列交换机
* 注意这里的交换机类型:CustomExchange * 注意这里的交换机类型:CustomExchange
* @return * @return
*/ */
@Bean @Bean(ORDER_CANCEL_EXC)
public CustomExchange delayExchange(){ public CustomExchange orderDelayExchange(){
Map<String, Object> args = new HashMap<>(); Map<String, Object> args = new HashMap<>();
args.put("x-delayed-type", "direct"); args.put("x-delayed-type", "direct");
return new CustomExchange(ORDER_CANCEL_EXC,"x-delayed-message",true, false, args); return new CustomExchange(ORDER_CANCEL_EXC,"x-delayed-message",true, false, args);
} }
/**
* 延时队列交换机
* 注意这里的交换机类型:CustomExchange
* @return
*/
@Bean(APPLY_CANCEL_EXC)
public CustomExchange applyDelayExchange(){
Map<String, Object> args = new HashMap<>();
args.put("x-delayed-type", "direct");
return new CustomExchange(APPLY_CANCEL_EXC,"x-delayed-message",true, false, args);
}
/** /**
* 延时队列 * 延时队列
* @return * @return
*/ */
@Bean @Bean(ORDER_CANCEL_QUE)
public Queue delayQueue(){ public Queue delayQueue(){
return new Queue(ORDER_CANCEL_QUE,true); return new Queue(ORDER_CANCEL_QUE,true);
} }
/** /**
* 延时队列
* @return
*/
@Bean(APPLY_CANCEL_QUE)
public Queue applyDelayQueue(){
return new Queue(APPLY_CANCEL_QUE,true);
}
/**
* 给延时队列绑定交换机 * 给延时队列绑定交换机
* @return * @return
*/ */
@Bean @Bean("cfgDelayBinding")
public Binding cfgDelayBinding(Queue cfgDelayQueue, CustomExchange cfgUserDelayExchange){ public Binding cfgDelayBinding(@Qualifier(ORDER_CANCEL_QUE) Queue cfgDelayQueue, @Qualifier(ORDER_CANCEL_EXC) CustomExchange cfgUserDelayExchange){
return BindingBuilder.bind(cfgDelayQueue).to(cfgUserDelayExchange).with(ORDER_CANCEL_KEY).noargs(); return BindingBuilder.bind(cfgDelayQueue).to(cfgUserDelayExchange).with(ORDER_CANCEL_KEY).noargs();
} }
// @Bean /**
// public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory){ * 给延时队列绑定交换机
// SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); * @return
// factory.setConnectionFactory(connectionFactory); */
//// factory.setMessageConverter(new Jackson2JsonMessageConverter()); @Bean("acqDelayBinding")
// factory.setAcknowledgeMode(AcknowledgeMode.MANUAL); public Binding acqDelayBinding(@Qualifier(APPLY_CANCEL_QUE) Queue acqDelayQueue, @Qualifier(APPLY_CANCEL_EXC) CustomExchange acqUserDelayExchange){
// return factory; return BindingBuilder.bind(acqDelayQueue).to(acqUserDelayExchange).with(APPLY_CANCEL_KEY).noargs();
// } }
} }
package com.xxfc.platform.order.mqhandler; package com.xxfc.platform.order.mqhandler;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.ShuntApply;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -8,8 +9,8 @@ import org.springframework.stereotype.Component; ...@@ -8,8 +9,8 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_EXC; import static com.xxfc.platform.order.config.RabbitDelayConfig.*;
import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_KEY; import static com.xxfc.platform.order.config.RabbitDelayConfig.APPLY_CANCEL_KEY;
/** /**
* rabbitMq生产者类 * rabbitMq生产者类
...@@ -39,5 +40,23 @@ public class RabbitProduct { ...@@ -39,5 +40,23 @@ public class RabbitProduct {
); );
log.info("{}ms后执行", delayTime); log.info("{}ms后执行", delayTime);
} }
public void sendApplyDelayMessage(ShuntApply shuntApply, Long delayTime) {
//这里的消息可以是任意对象,无需额外配置,直接传即可
log.info("===============延时队列生产消息====================");
log.info("发送时间:{},发送内容:{}", LocalDateTime.now(), shuntApply.toString());
this.rabbitTemplate.convertAndSend(
APPLY_CANCEL_EXC,
APPLY_CANCEL_KEY,
shuntApply,
message -> {
//注意这里时间可以使long,而且是设置header
message.getMessageProperties().setHeader("x-delay", delayTime);
return message;
}
);
log.info("{}ms后执行", delayTime);
}
} }
...@@ -131,7 +131,7 @@ public class AppOrderController extends CommonBaseController implements UserRest ...@@ -131,7 +131,7 @@ public class AppOrderController extends CommonBaseController implements UserRest
companyIds.clear(); companyIds.clear();
companyIds.add(dto.getStartCompanyId()); companyIds.add(dto.getStartCompanyId());
} else { } else {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ(new PageDataVO<>());
} }
} else { } else {
companyIds.add(dto.getStartCompanyId()); companyIds.add(dto.getStartCompanyId());
......
...@@ -14,6 +14,7 @@ import com.xxfc.platform.order.biz.OrderRentVehicleBiz; ...@@ -14,6 +14,7 @@ import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
import com.xxfc.platform.order.biz.ShuntApplyBiz; import com.xxfc.platform.order.biz.ShuntApplyBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz; import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.entity.ShuntApply; import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.RentVehicleBO; import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO; import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
import com.xxfc.platform.order.pojo.order.add.BgAddRentDTO; import com.xxfc.platform.order.pojo.order.add.BgAddRentDTO;
...@@ -25,6 +26,7 @@ import lombok.Data; ...@@ -25,6 +26,7 @@ import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.github.wxiaoqi.security.common.vo.PageDataVO.pageInfo; import static com.github.wxiaoqi.security.common.vo.PageDataVO.pageInfo;
import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CNL; import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CNL;
import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CRT; import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CRT;
...@@ -51,13 +53,19 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -51,13 +53,19 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/addApply", method = RequestMethod.POST) @RequestMapping(value = "/addApply", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "申请列表") @ApiOperation(value = "添加申请")
public ObjectRestResponse addApply(@RequestBody ShuntApply shuntApply) { public ObjectRestResponse addApply(@RequestBody ShuntApply shuntApply) {
//查询列表数据 //查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) { if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE); throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
} }
if(null != shuntApply.getStartCompanyId()) {
shuntApply.setStartCityCode(vehicleFeign.getCompanyDetail(shuntApply.getStartCompanyId()).getData().getAddrCity());
}
if(null != shuntApply.getEndCompanyId()) {
shuntApply.setEndCityCode(vehicleFeign.getCompanyDetail(shuntApply.getEndCompanyId()).getData().getAddrCity());
}
shuntApply.setUserId(getCurrentUserIdInt()); shuntApply.setUserId(getCurrentUserIdInt());
shuntApply.setStatus(STATUS_CRT); shuntApply.setStatus(STATUS_CRT);
return add(shuntApply); return add(shuntApply);
...@@ -125,6 +133,10 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -125,6 +133,10 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE); throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE);
} }
if(ShuntApply.STATUS_ORDER == shuntApply.getStatus()) {
throw new BaseException("该申请已下单", ResultCode.PARAM_ILLEGAL_CODE);
}
// BgAddRentDTO bgAddRentDTO = new BgAddRentDTO(); // BgAddRentDTO bgAddRentDTO = new BgAddRentDTO();
// bgAddRentDTO.setAppUserId(shuntApply.getUserId()); // bgAddRentDTO.setAppUserId(shuntApply.getUserId());
// bgAddRentDTO.setStartTime(shuntApply.getStartTime()); // bgAddRentDTO.setStartTime(shuntApply.getStartTime());
...@@ -147,9 +159,20 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -147,9 +159,20 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
// setDayNum(orderCalculateBiz.getIncludeDays(shuntApply.getStartTime(), shuntApply.getEndTime())); // setDayNum(orderCalculateBiz.getIncludeDays(shuntApply.getStartTime(), shuntApply.getEndTime()));
// }}; // }};
dto.setVehicleId(shuntApply.getVehicleId());
dto.setStartTime(shuntApply.getStartTime());
dto.setEndTime(shuntApply.getEndTime());
dto.setStartCompanyId(shuntApply.getStartCompanyId());
dto.setEndCompanyId(shuntApply.getEndCompanyId());
RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto); RentVehicleBO bo = orderRentVehicleBiz.initRentVehicleBO(dto);
bo.setApplyOrderSign(SYS_TRUE);
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData()); bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
orderRentVehicleService.applyCreateOrder(bo, shuntApply.getOrderNo()); orderRentVehicleService.applyCreateOrder(bo, shuntApply.getOrderNo());
baseBiz.updateSelectiveById(new ShuntApply(){{
setId(shuntApply.getId());
setStatus(ShuntApply.STATUS_ORDER);
setOrderStatus(ShuntApply.ORDER_STATUS_TOPAY);
}});
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
...@@ -161,6 +184,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -161,6 +184,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Data @Data
public static class ShuntApplyVO extends ShuntApply { public static class ShuntApplyVO extends ShuntApply {
VehicleModel vehicleModel; VehicleModel vehicleModel;
OrderPageVO orderPageVO;
} }
@Data @Data
......
...@@ -13,6 +13,7 @@ import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO; ...@@ -13,6 +13,7 @@ import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO; import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -246,4 +247,8 @@ public interface VehicleFeign { ...@@ -246,4 +247,8 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleInfo/selectByCompanyIds", method = RequestMethod.GET) @RequestMapping(value = "/vehicleInfo/selectByCompanyIds", method = RequestMethod.GET)
public ObjectRestResponse<List<Vehicle>> vehicleSelectByCompanyIds(@RequestParam("companyIds") String companyIds); public ObjectRestResponse<List<Vehicle>> vehicleSelectByCompanyIds(@RequestParam("companyIds") String companyIds);
@RequestMapping(value = "/vehicleInfo/rent/apply/usable-vehicle", method = RequestMethod.POST)
public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd);
} }
package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
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.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.biz.*;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.jobhandler.VehicleJobHandler;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehicleFindAppDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
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.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
@RestController
@RequestMapping("/chw/app/vehicle")
@Slf4j
@IgnoreClientToken
@Api(value="超惠玩车辆controller",tags={"超惠玩车辆接口"})
public class ChwAppVehicleController extends BaseController<VehicleBiz> implements UserRestInterface {
@Autowired
UserFeign userFeign;
@Autowired
VehicleBrandBiz vehicleBrandBiz;
@Autowired
VehicleCategoryBiz vehicleCategoryBiz;
@Override
public UserFeign getUserFeign() {
return userFeign;
}
@ApiOperation("vehicleBrand查询所有")
@RequestMapping(value = "/vehicleBrand/all",method = RequestMethod.GET)
@ResponseBody
@IgnoreUserToken
public List<VehicleBrand> all() {
return vehicleBrandBiz.selectListAll();
}
@ApiOperation("vehicleCategory查询分页")
@RequestMapping(value = "/vehicleCategory/page",method = RequestMethod.GET)
@ResponseBody
@IgnoreUserToken
public TableResultResponse<VehicleCategory> list(@RequestParam Map<String, Object> params){
//查询列表数据
Query query = new Query(params);
return vehicleCategoryBiz.selectPageByQuery(query);
}
}
...@@ -267,6 +267,39 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements ...@@ -267,6 +267,39 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
} }
@ApiOperation("调车申请列表-可用车辆查询")
@RequestMapping(value = "/rent/apply/usable-vehicle", method = RequestMethod.POST)
@IgnoreUserToken
public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd) {
rbd.setRecordIntersection(Boolean.TRUE);
rbd.setLimit(100);
rbd.setPage(1);
rbd.setYearNo4Where(Boolean.TRUE);
//查询可车辆信息
PageDataVO<UsableVeicleVO> pageDataVO = vehicleBiz.searchUsableVehicle(rbd);
if(CollUtil.isNotEmpty(pageDataVO.getData())) {
for (UsableVeicleVO usableVeicleVO : pageDataVO.getData()) {
//判断是否预定时间内可租
usableVeicleVO.setAllowRent(SYS_TRUE);
//如果"必须在这时间后预定" 存在 并且 比预定开始时间 要晚,那么不允许预定
if(null != usableVeicleVO.getToLiftMustAfterDate() && DateUtil.parse(rbd.getBookStartDateTime()).isBeforeOrEquals(usableVeicleVO.getToLiftMustAfterDate())) {
usableVeicleVO.setAllowRent(SYS_FALSE);
}
//如果"必须在这时间前预定" 存在 并且 比预定结束时间 要早,那么不允许预定
if(null != usableVeicleVO.getToReturnMustBeforeDate() && DateUtil.parse(rbd.getBookEndDateTime()).isAfterOrEquals(usableVeicleVO.getToReturnMustBeforeDate())) {
usableVeicleVO.setAllowRent(SYS_FALSE);
}
}
}
return ObjectRestResponse.succ(pageDataVO);
}
/** /**
* 后台查询可用车辆(车型) * 后台查询可用车辆(车型)
* *
......
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