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

修改车辆和公司相关bug

parent d31de4a9
......@@ -3,6 +3,8 @@ package com.github.wxiaoqi.security.common.exception;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import java.util.Map;
/**
* Created by ace on 2017/9/8.
*/
......@@ -50,4 +52,9 @@ public class BaseException extends RuntimeException {
super(ResultCode.getMsg(code));
this.status = code;
}
public BaseException(int code, Map<String, Object> map) {
super(ResultCode.getMsg(code));
this.status = code;
}
}
......@@ -40,7 +40,12 @@ public class EntityUtils {
* @author 王浩彬
*/
public static <T> void setCreateInfo(T entity){
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request;
try {
request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}catch (Exception e) {
request = null;
}
String hostIp = "";
String name = "";
String id = "";
......@@ -81,7 +86,12 @@ public class EntityUtils {
* @author 王浩彬
*/
public static <T> void setUpdatedInfo(T entity){
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request;
try {
request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
}catch (Exception e) {
request = null;
}
String hostIp = "";
String name = "";
String id = "";
......
......@@ -5,6 +5,10 @@ import com.github.wxiaoqi.security.common.util.SystemProperty;
public class ResultCode {
////////////////////////////参数相关///////////////////////////
public static int PARAM_ILLEGAL_CODE = Integer.valueOf(SystemProperty.getResultConfig("PARAM_ILLEGAL_CODE"));
public static int PARAM_EXPIRE_CODE = Integer.valueOf(SystemProperty.getResultConfig("PARAM_EXPIRE_CODE"));
// 操作成功
public static int SUCCESS_CODE = Integer.valueOf(SystemProperty.getResultConfig("SUCCESS_CODE"));
// 操作失败
......
......@@ -32,6 +32,14 @@ RSTOKEN_NULL_CODE=1007
DB_OPERATION_FAIL_CODE=1008
1008=数据库操作失败
#参数非法
PARAM_ILLEGAL_CODE=1011
1011=参数非法,请修改
#参数时效已过时
PARAM_EXPIRE_CODE=1010
1010=参数时效已过时,不能使用
#请求微信接口失败
WXAPI_CODE=2001
#微信用不不存在
......
......@@ -91,8 +91,16 @@ public class AddRentVehicleDTO{
/**
* 是否使用出租免费天数
*/
@ApiModelProperty(value = "是否使用出租免费天数")
private Integer rentFreeDay;
/**
* 优惠券ids
*/
@ApiModelProperty(value = "优惠券ids")
private String couponIds;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
......@@ -68,4 +68,10 @@ public class AddTourDTO {
@Column(name = "has_insure")
@ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要")
Integer hasInsure;
/**
* 优惠券ids
*/
@ApiModelProperty(value = "优惠券ids")
private String couponIds;
}
......@@ -144,7 +144,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//触发退款流程
//判断是否已支付
if(baseOrder.getHasPay().equals(SYS_TRUE)) {
if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//判断订单类型
if(OrderTypeEnum.RentVehicle.getCode().equals(baseOrder.getType())) {
OrderRentVehicleDetail orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{
......
package com.xxfc.platform.order.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -52,5 +53,14 @@ public class RabbitUserConfig {
public Binding cfgDelayBinding(Queue cfgDelayQueue, CustomExchange cfgUserDelayExchange){
return BindingBuilder.bind(cfgDelayQueue).to(cfgUserDelayExchange).with(ORDER_CANCEL_KEY).noargs();
}
// @Bean
// public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory){
// SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
// factory.setConnectionFactory(connectionFactory);
//// factory.setMessageConverter(new Jackson2JsonMessageConverter());
// factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
// return factory;
// }
}
......@@ -117,7 +117,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
AppUserDTO dto = detail.getAppUserDTO();
//如果用户存在,并且为会员,并且车辆有优惠价
if(null != dto && null != detail.getRentFreeDay() && detail.getRentFreeDay() > 0 && dto.getRentFreeDays() > 0) {
if(null != dto && null != detail.getRentFreeDay() && detail.getRentFreeDay() > 0 ) {
if(dto.getRentFreeDays() <= 0) {
throw new BaseException(ResultCode.PARAM_EXPIRE_CODE);
}
if(detail.getDayNum() > dto.getRentFreeDays()) {
freeDayNum = dto.getRentFreeDays();
}else {
......@@ -128,6 +131,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
vehicleDayNum = detail.getDayNum();
}
detail.setFreeDays(freeDayNum);
//计算价格
//计算车辆费用
VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
......
......@@ -24,15 +24,14 @@
, st_distance_sphere(point(#{lon}, #{lat}), point(longitude, latitude)) as distance
</if>
from branch_company
<trim prefix="where" suffixOverrides="and">
<if test="addrCity != null">
addr_city = #{addrCity}
</if>
<if test="lon != null and lat != null">
longitude is not null and latitude is not null
</if>
</trim>
<where>
<if test="addrCity != null">
and addr_city = #{addrCity}
</if>
<if test="lon != null and lat != null">
and longitude is not null and latitude is not null
</if>
</where>
<if test="lon != null and lat != null">
order by distance asc
</if>
......
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