Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
2ee3ba51
Commit
2ee3ba51
authored
Aug 30, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into hz_master
parents
c155be8c
f8684d3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
24 deletions
+52
-24
UsableVeicleDTO.java
.../java/com/xxfc/platform/vehicle/pojo/UsableVeicleDTO.java
+3
-0
VehicleActiveService.java
...a/com/xxfc/platform/vehicle/biz/VehicleActiveService.java
+13
-5
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+5
-0
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+31
-19
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/UsableVeicleDTO.java
View file @
2ee3ba51
...
@@ -54,6 +54,9 @@ public class UsableVeicleDTO extends PageParam {
...
@@ -54,6 +54,9 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty
(
hidden
=
true
)
@ApiModelProperty
(
hidden
=
true
)
Boolean
yearNo4Where
;
Boolean
yearNo4Where
;
@ApiModelProperty
(
hidden
=
true
)
Integer
withoutRecordWhere
=
1
;
public
void
setStartDateTamp
(
Long
startDateTamp
)
{
public
void
setStartDateTamp
(
Long
startDateTamp
)
{
this
.
startDateTamp
=
startDateTamp
;
this
.
startDateTamp
=
startDateTamp
;
this
.
startDate
=
DEFAULT_DATE_TIME_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
startDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
this
.
startDate
=
DEFAULT_DATE_TIME_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
startDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleActiveService.java
View file @
2ee3ba51
...
@@ -20,10 +20,7 @@ import org.springframework.stereotype.Service;
...
@@ -20,10 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Service
public
class
VehicleActiveService
{
public
class
VehicleActiveService
{
...
@@ -171,11 +168,13 @@ public class VehicleActiveService {
...
@@ -171,11 +168,13 @@ public class VehicleActiveService {
break
;
break
;
}
}
List
<
VehicleBookRecordVo
>
vehicleBookRecordVos
=
vehicleBookRecordBiz
.
selectByVehicleId
(
vehicleId
);
List
<
VehicleBookRecordVo
>
vehicleBookRecordVos
=
vehicleBookRecordBiz
.
selectByVehicleId
(
vehicleId
);
if
(
vehicleBookRecordVos
!=
null
&&
vehicleBookRecordVos
.
size
()
>
0
)
{
if
(
vehicleBookRecordVos
!=
null
&&
vehicleBookRecordVos
.
size
()
>
0
&&
vehicleBookRecordVos
.
get
(
0
).
getVehicleDepartureLogVo
()
!=
null
&&
vehicleBookRecordVos
.
get
(
0
).
getVehicleDepartureLogVo
().
getState
()
!=
1
)
{
stringBuilder
.
append
(
"中,使用人:"
);
stringBuilder
.
append
(
"中,使用人:"
);
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUsername
());
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUsername
());
stringBuilder
.
append
(
" 使用人电话:"
);
stringBuilder
.
append
(
" 使用人电话:"
);
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUserPhone
());
stringBuilder
.
append
(
vehicleBookRecordVos
.
get
(
0
).
getVehicleUserPhone
());
}
else
{
stringBuilder
.
append
(
", 请联系管理员修改车辆状态为正常状态"
);
}
}
return
stringBuilder
.
toString
();
return
stringBuilder
.
toString
();
}
}
...
@@ -309,6 +308,15 @@ public class VehicleActiveService {
...
@@ -309,6 +308,15 @@ public class VehicleActiveService {
param
.
put
(
"vehicleId"
,
vehicleBookRecord
.
getVehicleId
());
param
.
put
(
"vehicleId"
,
vehicleBookRecord
.
getVehicleId
());
param
.
put
(
"bookedEndDate"
,
vehicleBookRecord
.
getBookStartDate
());
param
.
put
(
"bookedEndDate"
,
vehicleBookRecord
.
getBookStartDate
());
List
<
VehicleBookRecordVo
>
list
=
vehicleBookRecordBiz
.
selectByVehicleIdAndTime
(
param
);
List
<
VehicleBookRecordVo
>
list
=
vehicleBookRecordBiz
.
selectByVehicleIdAndTime
(
param
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
Iterator
<
VehicleBookRecordVo
>
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
())
{
VehicleBookRecordVo
vehicleBookRecordVo
=
iterator
.
next
();
if
(
vehicleBookRecordVo
.
getVehicleDepartureLogVo
()
==
null
&&
vehicleBookRecordVo
.
getBookEndDate
().
getTime
()
-
new
Date
().
getTime
()
<
0
)
{
iterator
.
remove
();
}
}
}
if
(!(
startDate
.
minusDays
(
1
).
compareTo
(
DateTime
.
now
())
<=
0
&&
DateTime
.
now
().
compareTo
(
endDate
)
<=
0
&&
vehicleBookRecord
.
getStatus
()
==
VehicleBookRecordStatus
.
APPROVE
.
getCode
()
&&
(
list
==
null
||
list
.
size
()
<=
0
)))
{
if
(!(
startDate
.
minusDays
(
1
).
compareTo
(
DateTime
.
now
())
<=
0
&&
DateTime
.
now
().
compareTo
(
endDate
)
<=
0
&&
vehicleBookRecord
.
getStatus
()
==
VehicleBookRecordStatus
.
APPROVE
.
getCode
()
&&
(
list
==
null
||
list
.
size
()
<=
0
)))
{
throw
new
BaseException
(
ResCode
.
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED
.
getDesc
(),
throw
new
BaseException
(
ResCode
.
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED
.
getDesc
(),
ResCode
.
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED
.
getCode
());
ResCode
.
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED
.
getCode
());
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
2ee3ba51
...
@@ -1017,6 +1017,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -1017,6 +1017,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
}
if
(
MapUtils
.
isNotEmpty
(
yearMonthAndParam
)){
if
(
MapUtils
.
isNotEmpty
(
yearMonthAndParam
)){
params
.
put
(
"yearMonthAndParam"
,
yearMonthAndParam
);
params
.
put
(
"yearMonthAndParam"
,
yearMonthAndParam
);
String
bitStr
=
""
;
for
(
String
key
:
yearMonthAndParam
.
keySet
())
{
bitStr
+=
"1"
;
}
params
.
put
(
"yearMonthAndParamBitStr"
,
bitStr
);
}
}
}
}
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
2ee3ba51
...
@@ -522,10 +522,14 @@
...
@@ -522,10 +522,14 @@
</if>
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if
test=
" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true"
>
<if
test=
" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true"
>
,max(
,(max(
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
separator=
"and"
>
vbi.bit_str = #{yearMonthAndParamBitStr}
<include
refid=
"yearMonthAndParamSql"
></include>
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle-->
</foreach>
<if
test=
"withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null "
>
and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
</if>
)
) as hasVehicle
) as hasVehicle
</if>
</if>
<if
test=
"lon != null and lat != null"
>
<if
test=
"lon != null and lat != null"
>
...
@@ -557,7 +561,7 @@
...
@@ -557,7 +561,7 @@
) > 0
) > 0
</if>
</if>
)
)
<!-- union 所有车型 -->
<!-- union 所有
下架
车型 -->
<if
test=
"startCompanyId != null or parkBranchCompanyId != null "
>
<if
test=
"startCompanyId != null or parkBranchCompanyId != null "
>
union
union
(select vm.id as model_id, bc.id as company_id
(select vm.id as model_id, bc.id as company_id
...
@@ -598,9 +602,9 @@
...
@@ -598,9 +602,9 @@
<if
test=
"lon != null and lat != null"
>
<if
test=
"lon != null and lat != null"
>
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
</if>
<if
test=
" yearMonthAndParam !=null "
>
<!-- <if test=" yearMonthAndParam !=null ">--
>
,ifnull(vbi.booked_date,0) as booked_date
<!-- ,ifnull(vbi.booked_date,0) as booked_date-->
</if
>
<!-- </if>--
>
<include
refid=
"searchUsableSql"
/>
<include
refid=
"searchUsableSql"
/>
<if
test=
"lon != null and lat != null"
>
<if
test=
"lon != null and lat != null"
>
order by
order by
...
@@ -612,8 +616,18 @@
...
@@ -612,8 +616,18 @@
<sql
id=
"searchUsableSql"
>
<sql
id=
"searchUsableSql"
>
from vehicle v
from vehicle v
<if
test=
" yearMonthAndParam !=null "
>
<if
test=
" yearMonthAndParam !=null "
>
left join
left join (
vehicle_book_info vbi on v.`id` = vbi.vehicle
select
vbi.vehicle,
BIT_OR(
CONCAT(
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
separator=
","
>
<include
refid=
"yearMonthAndParamSql"
></include>
</foreach>
)
) as bit_str
from vehicle_book_info vbi group by vbi.vehicle
) vbi on v.`id` = vbi.vehicle
</if>
</if>
left join vehicle_model vm on v.model_id = vm.id
left join vehicle_model vm on v.model_id = vm.id
left join branch_company bc on v.park_branch_company_id = bc.id
left join branch_company bc on v.park_branch_company_id = bc.id
...
@@ -628,21 +642,19 @@
...
@@ -628,21 +642,19 @@
<where>
<where>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if
test=
" yearMonthAndParam !=null and yearNo4Where == null"
>
<if
test=
" yearMonthAndParam !=null and yearMonthAndParam != null and yearNo4Where == null"
>
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
>
vbi.bit_str = #{yearMonthAndParamBitStr}
and
<include
refid=
"yearMonthAndParamSql"
></include>
</foreach>
</if>
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- 根据前后record 过滤车辆 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if
test=
"startCompanyId != null and endCompanyId != null "
>
<if
test=
"startCompanyId != null and endCompanyId != null "
>
and (
<if
test=
"withoutRecordWhere == null"
>
and (
(abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
(abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and
and
(abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
(abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
)
)
</if>
</if>
</if>
<if
test=
" modelId != null "
>
<if
test=
" modelId != null "
>
and v.model_id = #{modelId}
and v.model_id = #{modelId}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment