Commit 6d868f69 authored by 周健威's avatar 周健威

Merge branch 'base-modify' into 'dev'

base-dev-merge

See merge request !3
parents af44b34c fed9a4b8
......@@ -123,4 +123,9 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
criteria.andIn("userid", userIds);
mapper.deleteByExample(example);
}
@CacheClear(pre = "user{1}")
public void updateUserPositionByUserId(Integer userId, Integer positionId) {
mapper.updateUserPositionByUserId(userId,positionId);
}
}
......@@ -18,4 +18,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
void updateUserMemberStatusByUserId(@Param("userId") Integer userId,@Param("status") Integer status);
void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId);
}
\ No newline at end of file
......@@ -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.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.feign.OrderFeign;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
......@@ -63,6 +64,9 @@ public class AppUserController extends CommonBaseController {
@Autowired
private MyWaterBiz myWaterBiz;
@Autowired
private OrderFeign orderFeign;
@GetMapping("page")
......@@ -141,6 +145,7 @@ public class AppUserController extends CommonBaseController {
UserMemberVo memberVo=userMemberBiz.getMemberInfoByUserId(userid);
if(memberVo!=null){
BeanUtils.copyProperties(userDTO,memberVo);
// userDTO.setPayCount(orderFeign.baseOrderEntityList(new BaseOrder()));
Integer level=memberVo.getMemberLevel();
BaseUserMemberLevel memberLevel=userMemberLevelBiz.getLevel(level);
if (memberLevel!=null){
......
package com.github.wxiaoqi.security.admin.rest;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserManageBiz;
import com.github.wxiaoqi.security.admin.constant.Status;
......@@ -38,6 +39,9 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired
private AppUserLoginBiz appUserLoginBiz;
@Autowired
private AppUserDetailBiz appUserDetailBiz;
@Autowired
protected UserAuthConfig userAuthConfig;
......@@ -126,5 +130,11 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
appUserLoginBiz.deleteAppUserById(id);
return ObjectRestResponse.succ();
}
@PutMapping("/user_position")
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id,@RequestParam("positionId") Integer positionId){
appUserDetailBiz.updateUserPositionByUserId(id,positionId);
return ObjectRestResponse.succ();
}
}
......@@ -125,4 +125,7 @@
<update id="updateUserMemberStatusByUserId">
update `app_user_detail` set `is_member`={status} where `userid`=#{userId}
</update>
<update id="updateUserPositionByUserId">
update `app_user_detail` set `position_id`=#{positionId} where `userid`=#{userId}
</update>
</mapper>
\ No newline at end of file
package com.xxfc.platform.app.rest.admin;
import com.xxfc.platform.app.biz.BuyVehicleFormBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/9 13:55
*/
@RestController
public class BuyVehicleFormAdminController {
@Autowired
private BuyVehicleFormBiz vehicleFormBiz;
}
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);
}
......@@ -19,6 +19,7 @@ import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.jexl2.MapContext;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -96,17 +97,23 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
}});
if(null == crosstown) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, new HashSet<String>(){{
add("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId());
}});
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId()));
}
if(null == crosstown.getRestDeposit()
|| crosstown.getRestDeposit().subtract(illegalReserve).compareTo(BigDecimal.ZERO) < 0 ){
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("退第一笔押金剩余金额异常,异常记录为:"+ crosstown.getId()));
}
//还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
BigDecimal originalRefundAmount = crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve);
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
if(null != crosstown.getDedDetail()) {
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
}
}
refundDesc += ")";
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT);
......
......@@ -165,7 +165,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(3501, "无收车权限");
}
}
if(baseOrder.getStatus() != -1) {
Vehicle vehicle = null;
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
......@@ -236,6 +235,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
orderVehicleCrosstownDto.setDeductionCost(amount);
//扣除费用
orderVehicleCrosstownDto.setRestDeposit(orderRentVehicleDetail.getDeposit().subtract(amount));
if(orderVehicleCrosstownDto.getRestDeposit().compareTo(getAmount()) == -1) { //剩余金额小于保证金
return ObjectRestResponse.createFailedResult(500,"押金不足,不能交车,请联系客服!");
}
//出车成功后修改订单状态
List<OrderVehicleCrosstownDto> oldValue = orderVehicleCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if (oldValue.size() == 1) {
......@@ -271,6 +273,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//总押金-保留金
totalAmount = objectRestResponse.getData().getOrderRentVehicleDetail().getDeposit();
}
if (baseOrder.getStatus() == OrderStatusEnum.ORDER_TOSTART.getCode()) {//交车
baseOrder.setStatus(OrderStatusEnum.ORDER_WAIT.getCode());
baseOrderBiz.updateSelectiveById(baseOrder);
......
......@@ -155,6 +155,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes
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("订单详情")
@RequestMapping(value = "/{no}", method = RequestMethod.GET)
@IgnoreClientToken
......
......@@ -419,6 +419,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId());
rentVehicleBookDTO.setLiftAddr(detail.getStartAddr());
rentVehicleBookDTO.setRetCompany(detail.getEndCompanyId());
if(null != detail.getAccompanyItems()) {
rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum)));
}
......
......@@ -36,6 +36,12 @@ public class RentVehicleBookDTO extends PageParam {
@ApiModelProperty("提车公司")
private Integer liftCompany;
/**
* 还车分公司
*/
@ApiModelProperty("还车分公司")
private Integer retCompany;
/**
* 目的地
*/
......
......@@ -41,6 +41,12 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty("停靠公司")
String parkBranchCompanyId;
@ApiModelProperty("开始公司Id")
String startCompanyId;
@ApiModelProperty("结束公司Id")
String endCompanyId;
@ApiModelProperty(hidden = true)
Boolean yearNo4Where;
......
......@@ -362,73 +362,7 @@
where id = #{vehicleId} and status = #{lastStatus}
</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 v1.*, bc2.name subordinateBranchName, bc3.name parkCompanyName, bc4.name destinationBranchCompanyName
from vehicle v1
......@@ -564,6 +498,74 @@
</where>
</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 部分条件 -->
<sql id="searchUsableSql">
from vehicle v
......@@ -573,10 +575,19 @@
</if>
left join vehicle_model vm on v.model_id = vm.id
left join branch_company bc on v.park_branch_company_id = bc.id
<if test="startCompanyId != null and endCompanyId != null ">
left join (
<include refid="aroundBookRecord"></include>
) abr on v.`id` = abr.vehicle_id
</if>
<if test=" catas != null ">
left join vehicle_cata vc on vm.id = vc.vehicle_model_id
</if>
<where>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
(abr.to_lift_company = null or (abr.to_lift_company = ))
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if test=" yearMonthAndParam !=null and yearNo4Where == null">
......@@ -585,7 +596,13 @@
<include refid="yearMonthAndParamSql"></include>
</foreach>
</if>
<if test="startCompanyId != null and endCompanyId != null ">
and (
(abr.to_lift_company = null or abr.to_lift_company = #{startCompanyId})
and
(abr.to_return_company = null or abr.to_return_company = #{endCompanyId})
)
</if>
<if test=" modelId != null ">
and v.model_id = #{modelId}
</if>
......@@ -611,4 +628,17 @@
)
</sql>
<!-- 前后被预定的情况 -->
<sql id = "aroundBookRecord">
select sevbr.*
, vbre.ret_company as to_lift_company
, vbrs.lift_company as to_return_company
from
(select vehicle_id, max(if(book_end_date &lt; #{start_date_extend}, book_end_date, null)) as max_book_end_date, min(if(book_start_date &gt; #{end_date_extend}, book_start_date, null)) as min_book_start_date from vehicle_book_record where status != 4 and status != 6 group by vehicle_id) sevbr
left join vehicle_book_record vbre
on sevbr.vehicle_id = vbre.vehicle_id and sevbr.max_book_end_date = vbre.book_end_date and vbre.status != 4 and vbre.status != 6
left join vehicle_book_record vbrs
on sevbr.vehicle_id = vbrs.vehicle_id and sevbr.min_book_start_date = vbrs.book_start_date and vbrs.status != 4 and vbrs.status != 6;
</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