Commit eb427261 authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents db461e19 643db455
package com.xxfc.platform.order.interceptor;
package com.github.wxiaoqi.security.common.interceptor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.cors.CorsUtils;
......
......@@ -6,7 +6,13 @@ import lombok.Data;
import java.math.BigDecimal;
@Data
public class UnitPriceDTO {
public class OrderAboutParamDTO {
@ApiModelProperty(value = "旅游保险单价")
private BigDecimal insurePrice;
@ApiModelProperty(value = "租车订单自动取消时间(毫秒)")
private Long actRent;
@ApiModelProperty(value = "旅游订单自动取消时间(毫秒)")
private Long actTour;
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.xxfc.platform.order.config;
import com.github.wxiaoqi.security.auth.client.interceptor.ServiceAuthRestInterceptor;
import com.github.wxiaoqi.security.auth.client.interceptor.UserAuthRestInterceptor;
import com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler;
import com.xxfc.platform.order.interceptor.CorsInterceptor;
import com.github.wxiaoqi.security.common.interceptor.CorsInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
......
......@@ -24,10 +24,9 @@ import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.order.CancelOrderDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.UnitPriceDTO;
import com.xxfc.platform.order.pojo.order.OrderAboutParamDTO;
import com.xxfc.platform.order.pojo.pay.RentVehicleOrderPayVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.constant.enumerate.PayChannelEnum;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderPayVo;
......@@ -47,7 +46,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -94,13 +92,28 @@ public class BaseOrderController extends CommonBaseController {
@ApiOperation(value = "获取订单相关的单价")
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<UnitPriceDTO> getOrderUnitPrice() {
public ObjectRestResponse<OrderAboutParamDTO> getOrderUnitPrice() {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
return ObjectRestResponse.succ(new UnitPriceDTO(){{
return ObjectRestResponse.succ(new OrderAboutParamDTO(){{
setInsurePrice(new BigDecimal(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.INSURE_PRICE).getDetail()));
}});
}
@RequestMapping(value = "/app/unauth/getOrderParam", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取订单相关的参数")
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<OrderAboutParamDTO> getOrderParam() {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
return ObjectRestResponse.succ(new OrderAboutParamDTO(){{
setInsurePrice(new BigDecimal(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.INSURE_PRICE).getDetail()));
setActRent(new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.ACT_RENT).getDetail()));
setActTour(new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.ACT_TOUR).getDetail()));
}});
}
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单列表")
......
......@@ -2,17 +2,22 @@ package com.xxfc.platform.vehicle.pojo;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class UsableVehicleModelVO {
//车辆id
@ApiModelProperty(value = "公里数")
BigDecimal distance;
@ApiModelProperty(value = "车型信息")
VehicleModel vehicleModel;
@ApiModelProperty(value = "公司信息")
BranchCompany company;
@ApiModelProperty(value = "是否有车")
Integer hasVehicle;
}
\ No newline at end of file
......@@ -39,6 +39,9 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty(value = "分类列表", hidden = true)
Map<Integer, List<VehiclePlatCata>> catas;
@ApiModelProperty(hidden = true)
Boolean yearNo4Where;
public void setStartDateTamp(Long startDateTamp) {
this.startDateTamp = startDateTamp;
this.startDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTamp), ZoneOffset.ofHours(8)));
......
......@@ -3,7 +3,7 @@ package com.xxfc.platform.vehicle.config;
import com.github.wxiaoqi.security.auth.client.interceptor.ServiceAuthRestInterceptor;
import com.github.wxiaoqi.security.auth.client.interceptor.UserAuthRestInterceptor;
import com.github.wxiaoqi.security.common.handler.GlobalExceptionHandler;
import com.xxfc.platform.vehicle.interceptor.CorsInterceptor;
import com.github.wxiaoqi.security.common.interceptor.CorsInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
......
package com.xxfc.platform.vehicle.interceptor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.cors.CorsUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by ace on 2017/9/12.
*/
public class CorsInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (request.getHeader(HttpHeaders.ORIGIN) != null) {
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Allow-Credentials", "true");
response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT, HEAD");
response.addHeader("Access-Control-Allow-Headers", "Content-Type,authorization");
response.addHeader("Access-Control-Max-Age", "3600");
}
if(CorsUtils.isPreFlightRequest(request)){//是否跨域前option请求,使得话不执行后面拦截器
return Boolean.FALSE;
}
return super.preHandle(request, response, handler);
}
}
......@@ -375,8 +375,10 @@ public class VehicleController extends BaseController<VehicleBiz> {
vpcs.add(vpc);
vpcMap.put(vpc.getParentId(), vpcs);
}
dto.setCatas(vpcMap);
//设置显示是否有车
//dto.setYearNo4Where(Boolean.TRUE);
}
return new ObjectRestResponse<>().data(vehicleBiz.searchUsableModel(dto)).rel(true);
}
......
......@@ -96,7 +96,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
* @return
*/
@ApiOperation("车型列表")
@PostMapping(value = "/app/unauthfind/VehicleModelPage")
@PostMapping(value = "/app/unauthfind/findVehicleModelPage")
public ObjectRestResponse<VehicleModelVo> findVehicleModelPageUnauthfind(
@RequestBody @ApiParam("查询条件") VehicleModelQueryCondition vmqc ,HttpServletRequest request) {
......@@ -296,9 +296,9 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
* @return
*/
@ApiOperation("车型列表")
@PostMapping(value = "/app/VehicleModelPage")
@PostMapping(value = "/app/findVehicleModelPage")
public ObjectRestResponse<VehicleModelVo> findVehicleModelPage(
@RequestBody @ApiParam("查询条件") VehicleModelQueryCondition vmqc ,HttpServletRequest request) {
@RequestBody @ApiParam("查询条件") VehicleModelQueryCondition vmqc ) {
if (vmqc.getIsDel()==null) {
vmqc.setIsDel(0);
......
......@@ -363,6 +363,14 @@
<if test=" catas != null ">
,GROUP_CONCAT(vc.cata_id) as catas
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
) as hasVehicle
</if>
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
......@@ -372,6 +380,7 @@
and bc.id is not null
GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if>
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">, hasVehicle</if>
<!-- 循环 相同父级 数据做并集, 不同父级做或集 -->
<if test=" catas != null ">
......@@ -391,7 +400,10 @@
<if test="lon != null and lat != null">
order by
distance asc
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc,
</if>
distance asc
</if>
</select>
......@@ -535,10 +547,10 @@
GROUP BY status
</select>
<!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 -->
<sql id="searchUsableSql">
from vehicle v
<if test=" yearMonthAndParam !=null ">
<if test=" yearMonthAndParam !=null ">
left join
vehicle_book_info vbi on v.`id` = vbi.vehicle
</if>
......@@ -549,15 +561,14 @@
</if>
<where>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if test=" yearMonthAndParam !=null and yearNo4Where == null">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} =
#{andOperation.andOperationRs}
)
and
<include refid="yearMonthAndParamSql"></include>
</foreach>
</if>
<if test=" modelId != null ">
and v.model_id = #{modelId}
</if>
......@@ -570,4 +581,13 @@
</where>
</sql>
<!-- 时间参数循环 -->
<sql id = "yearMonthAndParamSql">
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} =
#{andOperation.andOperationRs}
)
</sql>
</mapper>
\ No newline at end of file
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