Commit 3c8d346f authored by 周健威's avatar 周健威

修改代码

parent 7f2e8a79
...@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.TableResultResponse; ...@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController; import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.feign.OrderFeign;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
...@@ -63,6 +64,9 @@ public class AppUserController extends CommonBaseController { ...@@ -63,6 +64,9 @@ public class AppUserController extends CommonBaseController {
@Autowired @Autowired
private MyWaterBiz myWaterBiz; private MyWaterBiz myWaterBiz;
@Autowired
private OrderFeign orderFeign;
@GetMapping("page") @GetMapping("page")
...@@ -141,6 +145,7 @@ public class AppUserController extends CommonBaseController { ...@@ -141,6 +145,7 @@ public class AppUserController extends CommonBaseController {
UserMemberVo memberVo=userMemberBiz.getMemberInfoByUserId(userid); UserMemberVo memberVo=userMemberBiz.getMemberInfoByUserId(userid);
if(memberVo!=null){ if(memberVo!=null){
BeanUtils.copyProperties(userDTO,memberVo); BeanUtils.copyProperties(userDTO,memberVo);
// userDTO.setPayCount(orderFeign.baseOrderEntityList(new BaseOrder()));
Integer level=memberVo.getMemberLevel(); Integer level=memberVo.getMemberLevel();
BaseUserMemberLevel memberLevel=userMemberLevelBiz.getLevel(level); BaseUserMemberLevel memberLevel=userMemberLevelBiz.getLevel(level);
if (memberLevel!=null){ if (memberLevel!=null){
......
package com.xxfc.platform.order.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by ace on 2017/9/15.
*/
@FeignClient(name = "vehicle")
public interface OrderFeign {
@GetMapping("/baseOrder/entityList")
public ObjectRestResponse<List<BaseOrder>> baseOrderEntityList(@RequestParam("entity") Map<String, Object> entity);
}
...@@ -155,6 +155,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -155,6 +155,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return new ObjectRestResponse<>().data(pages); return new ObjectRestResponse<>().data(pages);
} }
@ApiOperation("根据参数查询,等于")
@RequestMapping(value = "/entityList",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<BaseOrder>> entityList(BaseOrder entity){
//查询列表数据
return ObjectRestResponse.succ(baseOrderBiz.selectList(entity));
}
@ApiOperation("订单详情") @ApiOperation("订单详情")
@RequestMapping(value = "/{no}", method = RequestMethod.GET) @RequestMapping(value = "/{no}", method = RequestMethod.GET)
@IgnoreClientToken @IgnoreClientToken
......
...@@ -362,73 +362,7 @@ ...@@ -362,73 +362,7 @@
where id = #{vehicleId} and status = #{lastStatus} where id = #{vehicleId} and status = #{lastStatus}
</update> </update>
<select id="searchUsableModel" parameterType="java.util.Map"
resultMap="searchUsableModelMap">
select distinct vm.id as model_id, bc.id as company_id
<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">
,max(
<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>
<include refid="searchUsableSql"/>
and vm.id is not null
and vm.status = 1
and vm.isdel = 0
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 ">
having ( 1
<foreach collection="catas" index="key" item="cataList">
&amp; (
<foreach collection="cataList" index="cIndex" item="cata">
<if test=" cIndex != 0">
|
</if>
(case when FIND_IN_SET(#{cata.id},catas) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="lon != null and lat != null">
order by
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc,
</if>
distance asc
</if>
</select>
<select id="searchUsableVehicle" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select v.*
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<if test=" yearMonthAndParam !=null ">
,ifnull(vbi.booked_date,0) as booked_date
</if>
<include refid="searchUsableSql"/>
<if test="lon != null and lat != null">
order by
distance asc
</if>
</select>
<select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel"> <select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel">
select v1.*, bc2.name subordinateBranchName, bc3.name parkCompanyName, bc4.name destinationBranchCompanyName select v1.*, bc2.name subordinateBranchName, bc3.name parkCompanyName, bc4.name destinationBranchCompanyName
from vehicle v1 from vehicle v1
...@@ -564,6 +498,74 @@ ...@@ -564,6 +498,74 @@
</where> </where>
</select> </select>
<select id="searchUsableModel" parameterType="java.util.Map"
resultMap="searchUsableModelMap">
select distinct vm.id as model_id, bc.id as company_id
<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">
,max(
<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>
<include refid="searchUsableSql"/>
and vm.id is not null
and vm.status = 1
and vm.isdel = 0
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 ">
having ( 1
<foreach collection="catas" index="key" item="cataList">
&amp; (
<foreach collection="cataList" index="cIndex" item="cata">
<if test=" cIndex != 0">
|
</if>
(case when FIND_IN_SET(#{cata.id},catas) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="lon != null and lat != null">
order by
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc,
</if>
distance asc
</if>
</select>
<select id="searchUsableVehicle" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select v.*
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<if test=" yearMonthAndParam !=null ">
,ifnull(vbi.booked_date,0) as booked_date
</if>
<include refid="searchUsableSql"/>
<if test="lon != null and lat != null">
order by
distance asc
</if>
</select>
<!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 --> <!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 -->
<sql id="searchUsableSql"> <sql id="searchUsableSql">
from vehicle v from vehicle v
......
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