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
d60de735
Commit
d60de735
authored
Jul 24, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发现排序
parent
c9938091
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
248 additions
and
54 deletions
+248
-54
UserInfoBiz.java
...ain/java/com/xxfc/platform/activity/user/UserInfoBiz.java
+10
-0
OrderVehicalCrosstownBiz.java
...com/xxfc/platform/order/biz/OrderVehicalCrosstownBiz.java
+4
-3
BookType.java
...ain/java/com/xxfc/platform/vehicle/constant/BookType.java
+10
-2
VehicleBookHourInfo.java
...com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
+3
-0
VehicleBookRecord.java
...a/com/xxfc/platform/vehicle/entity/VehicleBookRecord.java
+12
-1
BookVehicleVO.java
...in/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
+5
-0
RentVehicleBookDTO.java
...va/com/xxfc/platform/vehicle/pojo/RentVehicleBookDTO.java
+4
-0
VehicleBookRecordDateVo.java
...m/xxfc/platform/vehicle/pojo/VehicleBookRecordDateVo.java
+10
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+137
-19
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+31
-24
VehicleBookRecordBiz.java
...a/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
+13
-0
VehicleBookHourInfoMapper.java
...fc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
+2
-0
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+3
-4
VehicleBookHourInfoMapper.xml
...r/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
+4
-1
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/user/UserInfoBiz.java
View file @
d60de735
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.activity.user;
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.activity.user;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -26,4 +27,13 @@ public class UserInfoBiz {
...
@@ -26,4 +27,13 @@ public class UserInfoBiz {
}
}
return
null
;
return
null
;
}
}
public
UserDTO
getAdminUserInfo
()
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
if
(
request
.
getHeader
(
"Authorization"
)
!=
null
)
{
return
userFeign
.
userinfoByToken
(
request
.
getHeader
(
"Authorization"
)).
getData
();
}
return
null
;
}
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicalCrosstownBiz.java
View file @
d60de735
...
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.activity.user.UserInfoBiz
;
import
com.xxfc.platform.activity.user.UserInfoBiz
;
...
@@ -74,14 +75,14 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
...
@@ -74,14 +75,14 @@ public class OrderVehicalCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
public
ObjectRestResponse
<
OrderVehicleCrosstownDto
>
add
(
OrderVehicleCrosstownDto
orderVehicleCrosstownDto
)
{
public
ObjectRestResponse
<
OrderVehicleCrosstownDto
>
add
(
OrderVehicleCrosstownDto
orderVehicleCrosstownDto
)
{
log
.
info
(
"添加的参数:orderVehicaleCrosstown = {}"
,
orderVehicleCrosstownDto
);
log
.
info
(
"添加的参数:orderVehicaleCrosstown = {}"
,
orderVehicleCrosstownDto
);
AppUserDTO
appUserDTO
=
userInfoBiz
.
get
UserInfo
();
UserDTO
userDTO
=
userInfoBiz
.
getAdmin
UserInfo
();
if
(
appU
serDTO
==
null
)
{
if
(
u
serDTO
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
return
ObjectRestResponse
.
createFailedResult
(
508
,
"token is null or invalid"
);
}
}
if
(
orderVehicleCrosstownDto
==
null
||
orderVehicleCrosstownDto
.
getOrderId
()
==
null
)
{
if
(
orderVehicleCrosstownDto
==
null
||
orderVehicleCrosstownDto
.
getOrderId
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
500
,
"参数为空!"
);
return
ObjectRestResponse
.
createFailedResult
(
500
,
"参数为空!"
);
}
}
orderVehicleCrosstownDto
.
setOrperaterId
(
appUserDTO
.
getUseri
d
());
orderVehicleCrosstownDto
.
setOrperaterId
(
userDTO
.
getI
d
());
BaseOrder
baseOrder
=
baseOrderBiz
.
selectById
(
orderVehicleCrosstownDto
.
getOrderId
());
BaseOrder
baseOrder
=
baseOrderBiz
.
selectById
(
orderVehicleCrosstownDto
.
getOrderId
());
if
(
baseOrder
==
null
)
{
if
(
baseOrder
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
500
,
"订单不存在!"
);
return
ObjectRestResponse
.
createFailedResult
(
500
,
"订单不存在!"
);
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/constant/BookType.java
View file @
d60de735
...
@@ -3,10 +3,18 @@ package com.xxfc.platform.vehicle.constant;
...
@@ -3,10 +3,18 @@ package com.xxfc.platform.vehicle.constant;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
/**
* 预定车辆用途
*/
public
enum
BookType
{
public
enum
BookType
{
USER_RENT
(
1
,
"用户租赁
"
),
EMPLOYEE_APPLY
(
1
,
"还车
"
),
EMPLOYEE_APPLY
(
2
,
"内部员工申请
"
),
USER_RENT
(
2
,
"租车
"
),
REPAIRING
(
3
,
"维修"
),
REPAIRING
(
3
,
"维修"
),
SHOW
(
4
,
"展览"
),
TOUR
(
5
,
"旅游"
),
MAINTAIN
(
6
,
"保养"
),
BOOKING
(
7
,
"预约中"
),
DISABLE
(
8
,
"禁用"
)
;
;
/**
/**
* 编码
* 编码
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
View file @
d60de735
...
@@ -27,4 +27,7 @@ public class VehicleBookHourInfo {
...
@@ -27,4 +27,7 @@ public class VehicleBookHourInfo {
@Column
(
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
private
Date
updateTime
;
@Column
(
name
=
"book_record_id"
)
private
Long
bookRecordId
;
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleBookRecord.java
View file @
d60de735
...
@@ -4,6 +4,7 @@ import lombok.Data;
...
@@ -4,6 +4,7 @@ import lombok.Data;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Table
(
name
=
"vehicle_book_record"
)
@Table
(
name
=
"vehicle_book_record"
)
@Data
@Data
...
@@ -26,7 +27,7 @@ public class VehicleBookRecord {
...
@@ -26,7 +27,7 @@ public class VehicleBookRecord {
private
Integer
status
;
private
Integer
status
;
/**
/**
* 预定类型,1-
用户租赁、2-分公司使用、3-维修
* 预定类型,1-
租车、2-分公司使用、3-维修、4、展览、5、旅游、6、保养、7、预约中、8、禁用
*/
*/
@Column
(
name
=
"book_type"
)
@Column
(
name
=
"book_type"
)
private
Integer
bookType
;
private
Integer
bookType
;
...
@@ -175,5 +176,15 @@ public class VehicleBookRecord {
...
@@ -175,5 +176,15 @@ public class VehicleBookRecord {
*/
*/
private
Integer
haveViolation
;
private
Integer
haveViolation
;
/**
* 订单号
*/
private
String
orderNo
;
@Transient
private
List
<
String
>
startHourList
;
@Transient
private
List
<
String
>
endHourList
;
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
View file @
d60de735
...
@@ -87,4 +87,9 @@ public class BookVehicleVO {
...
@@ -87,4 +87,9 @@ public class BookVehicleVO {
//还车分公司
//还车分公司
private
Integer
retCompany
;
private
Integer
retCompany
;
/**
* 预定车辆用途
*/
private
Integer
bookType
;
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/RentVehicleBookDTO.java
View file @
d60de735
...
@@ -44,4 +44,8 @@ public class RentVehicleBookDTO extends PageParam {
...
@@ -44,4 +44,8 @@ public class RentVehicleBookDTO extends PageParam {
*/
*/
@ApiModelProperty
(
"用户名"
)
@ApiModelProperty
(
"用户名"
)
private
String
userName
;
private
String
userName
;
@ApiModelProperty
(
"订单号"
)
private
String
orderNo
;
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleBookRecordDateVo.java
0 → 100644
View file @
d60de735
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookRecord
;
import
lombok.Data
;
@Data
public
class
VehicleBookRecordDateVo
extends
VehicleBookRecord
{
VehicleBookHourInfo
vehicleBookHourInfo
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
d60de735
...
@@ -17,14 +17,8 @@ import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
...
@@ -17,14 +17,8 @@ import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.constant.*
;
import
com.xxfc.platform.vehicle.constant.*
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.entity.*
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.mapper.*
;
import
com.xxfc.platform.vehicle.entity.VehicleBookInfo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookRecord
;
import
com.xxfc.platform.vehicle.mapper.BookRecordAccItemMapper
;
import
com.xxfc.platform.vehicle.mapper.VehicleBookInfoMapper
;
import
com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper
;
import
com.xxfc.platform.vehicle.mapper.VehicleMapper
;
import
com.xxfc.platform.vehicle.pojo.*
;
import
com.xxfc.platform.vehicle.pojo.*
;
import
com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto
;
import
com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -73,7 +67,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -73,7 +67,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Autowired
@Autowired
private
VehicleBookInfoMapper
vehicleBookInfoMapper
;
private
VehicleBookInfoMapper
vehicleBookInfoMapper
;
@Autowired
@Autowired
private
VehicleBookRecord
Mapper
vehicleBookRecordMapper
;
private
VehicleBookRecord
Biz
vehicleBookRecordBiz
;
@Autowired
@Autowired
private
ConstantBiz
constantBiz
;
private
ConstantBiz
constantBiz
;
@Autowired
@Autowired
...
@@ -333,7 +327,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -333,7 +327,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//加入预定申请记录
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookRecord
.
setBookType
(
BookType
.
EMPLOYEE_APPLY
.
getCode
());
vehicleBookRecord
.
setBookType
(
bookVehicleVo
.
getBookType
());
vehicleBookRecord
.
set
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUserName
(
userName
);
vehicleBookRecord
.
setBookUserName
(
userName
);
...
@@ -346,7 +341,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -346,7 +341,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
vehicleBookRecord
.
setDestination
(
bookVehicleVo
.
getDestination
());
vehicleBookRecord
.
setDestination
(
bookVehicleVo
.
getDestination
());
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecord
.
setRetCompany
(
bookVehicleVo
.
getRetCompany
());
vehicleBookRecord
.
setRetCompany
(
bookVehicleVo
.
getRetCompany
());
vehicleBookRecord
Mapper
.
insertSelecti
ve
(
vehicleBookRecord
);
vehicleBookRecord
Biz
.
sa
ve
(
vehicleBookRecord
);
// //添加预定时间记录
// //添加预定时间记录
//
//
// Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate());
// Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours(bookVehicleVo.getBookStartDate(), bookVehicleVo.getBookEndDate());
...
@@ -380,6 +375,80 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -380,6 +375,80 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
return
vehicleBookRecord
;
return
vehicleBookRecord
;
}
}
@Transactional
public
VehicleBookRecord
applyVehicle
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicleId
());
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
}
//检查车辆是否可以预定
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookRecord
.
setBookType
(
bookVehicleVo
.
getBookType
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setBookUser
(
userId
);
vehicleBookRecord
.
setBookUserName
(
userName
);
vehicleBookRecord
.
setBookStartDate
(
new
DateTime
(
new
DateTime
(
startDay
.
toDateTime
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
)).
toDate
());
vehicleBookRecord
.
setBookEndDate
(
new
DateTime
(
new
DateTime
(
endDay
.
toDateTime
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
)).
toDate
());
vehicleBookRecord
.
setLiftAddr
(
bookVehicleVo
.
getLiftAddr
());
vehicleBookRecord
.
setRemark
(
bookVehicleVo
.
getRemark
());
vehicleBookRecord
.
setDestination
(
bookVehicleVo
.
getDestination
());
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecord
.
setRetCompany
(
bookVehicleVo
.
getRetCompany
());
vehicleBookRecordBiz
.
save
(
vehicleBookRecord
);
// //添加预定时间记录
VehicleBookRecord
newValue
=
vehicleBookRecordBiz
.
selectOne
(
vehicleBookRecord
);
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
());
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookHourInfoDto
.
setYearMonthDay
(
entry
.
getKey
());
vehicleBookHourInfoDto
.
setBookedHour
(
entry
.
getValue
());
vehicleBookHourInfoDto
.
setBookRecordId
(
newValue
.
getId
());
vehicleBookHourInfoBiz
.
save
(
vehicleBookHourInfoDto
);
}
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
//添加随车物品
List
<
Map
<
String
,
Object
>>
params
=
Lists
.
newArrayList
();
if
(
MapUtils
.
isNotEmpty
(
bookVehicleVo
.
getSelectedAccItem
())){
for
(
Map
.
Entry
<
Integer
,
Integer
>
idAndAmount
:
bookVehicleVo
.
getSelectedAccItem
().
entrySet
()){
Map
<
String
,
Object
>
row
=
Maps
.
newHashMap
();
row
.
put
(
"id"
,
idAndAmount
.
getKey
());
row
.
put
(
"amount"
,
idAndAmount
.
getValue
());
row
.
put
(
"bookRecordId"
,
vehicleBookRecord
.
getId
());
params
.
add
(
row
);
}
bookRecordAccItemMapper
.
batchAdd
(
params
);
}
return
vehicleBookRecord
;
}
@Transactional
@Transactional
public
Boolean
applyVehicle4EmployeePerMonth
(
String
vehicleId
,
List
<
String
>
bookedDates
,
String
yearMonth
){
public
Boolean
applyVehicle4EmployeePerMonth
(
String
vehicleId
,
List
<
String
>
bookedDates
,
String
yearMonth
){
//检查车辆是否有空档
//检查车辆是否有空档
...
@@ -411,7 +480,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -411,7 +480,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Transactional
@Transactional
public
RestResponse
<
Integer
>
reviewVehicleBooking
(
Integer
operatorId
,
Long
bookRecordId
,
Integer
rsStatus
,
String
userName
)
throws
Exception
{
public
RestResponse
<
Integer
>
reviewVehicleBooking
(
Integer
operatorId
,
Long
bookRecordId
,
Integer
rsStatus
,
String
userName
)
throws
Exception
{
//获取相关申请记录
//获取相关申请记录
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecord
Mapper
.
selectByPrimaryKey
(
bookRecordId
);
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecord
Biz
.
selectById
(
bookRecordId
);
//申请记录验证
//申请记录验证
if
(
vehicleBookRecord
==
null
){
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
throw
new
CustomIllegalParamException
(
" invalid book record"
);
...
@@ -447,7 +516,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -447,7 +516,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
updateParam
.
put
(
"reviewerApply"
,
operatorId
);
updateParam
.
put
(
"reviewerApply"
,
operatorId
);
updateParam
.
put
(
"reviewerNameApply"
,
userName
);
updateParam
.
put
(
"reviewerNameApply"
,
userName
);
updateParam
.
put
(
"statusCondition"
,
VehicleBookRecordStatus
.
APPLY
.
getCode
());
updateParam
.
put
(
"statusCondition"
,
VehicleBookRecordStatus
.
APPLY
.
getCode
());
Integer
effected
=
vehicleBookRecord
Mapper
.
changeRecordStatus
(
updateParam
);
Integer
effected
=
vehicleBookRecord
Biz
.
changeRecordStatus
(
updateParam
);
if
(
effected
==
0
){
//修改失败,手动回滚
if
(
effected
==
0
){
//修改失败,手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
...
@@ -467,7 +536,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -467,7 +536,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Transactional
@Transactional
public
RestResponse
unbookVehicle4Employee
(
Integer
operatorId
,
Long
bookRecordId
,
String
userName
)
throws
Exception
{
public
RestResponse
unbookVehicle4Employee
(
Integer
operatorId
,
Long
bookRecordId
,
String
userName
)
throws
Exception
{
//获取相关申请记录
//获取相关申请记录
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecord
Mapper
.
selectByPrimaryKey
(
bookRecordId
);
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecord
Biz
.
selectById
(
bookRecordId
);
//申请记录验证
//申请记录验证
if
(
vehicleBookRecord
==
null
){
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
throw
new
CustomIllegalParamException
(
" invalid book record"
);
...
@@ -495,7 +564,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -495,7 +564,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
updateParam
.
put
(
"reviewerCancel"
,
operatorId
);
updateParam
.
put
(
"reviewerCancel"
,
operatorId
);
updateParam
.
put
(
"reviewerNameCancel"
,
userName
);
updateParam
.
put
(
"reviewerNameCancel"
,
userName
);
updateParam
.
put
(
"statusCondition"
,
VehicleBookRecordStatus
.
APPROVE
.
getCode
());
updateParam
.
put
(
"statusCondition"
,
VehicleBookRecordStatus
.
APPROVE
.
getCode
());
Integer
effected
=
vehicleBookRecord
Mapper
.
changeRecordStatus
(
updateParam
);
Integer
effected
=
vehicleBookRecord
Biz
.
changeRecordStatus
(
updateParam
);
if
(
effected
==
0
){
//修改失败,手动回滚
if
(
effected
==
0
){
//修改失败,手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
...
@@ -553,8 +622,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -553,8 +622,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
//提取日期和相应的预定目标日期
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
D
EFAULT_D
ATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
D
EFAULT_D
ATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
...
@@ -617,13 +686,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -617,13 +686,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
* 检查车辆是否存在
* 检查车辆是否存在
* @param id
* @param id
*/
*/
public
void
checkIfVehicleExists
(
String
id
){
public
boolean
checkIfVehicleExists
(
String
id
){
Integer
count
=
mapper
.
selectCount
(
new
Vehicle
(){{
Integer
count
=
mapper
.
selectCount
(
new
Vehicle
(){{
setId
(
id
);
setId
(
id
);
}});
}});
if
(
count
<=
0
){
if
(
count
<=
0
){
throw
new
CustomIllegalParamException
(
" no such vehicle"
)
;
return
false
;
}
}
return
true
;
}
}
/**
/**
...
@@ -1090,6 +1160,31 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -1090,6 +1160,31 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
Query
query
=
new
Query
(
vehiclePlanDto
);
Query
query
=
new
Query
(
vehiclePlanDto
);
PageDataVO
<
VehicleAndModelInfoVo
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getAllVehicle
(
query
.
getSuper
()));
PageDataVO
<
VehicleAndModelInfoVo
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getAllVehicle
(
query
.
getSuper
()));
for
(
VehicleAndModelInfoVo
vehicleAndModelInfoVo
:
pageDataVO
.
getData
())
{
for
(
VehicleAndModelInfoVo
vehicleAndModelInfoVo
:
pageDataVO
.
getData
())
{
//获取时间
if
(
vehicleAndModelInfoVo
.
getVehicleBookRecord
()
!=
null
)
{
for
(
VehicleBookRecord
vehicleBookRecord
:
vehicleAndModelInfoVo
.
getVehicleBookRecord
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setVehicleId
(
vehicleBookRecord
.
getVehicleId
());
vehicleBookHourInfoDto
.
setBookRecordId
(
vehicleBookRecord
.
getId
());
vehicleBookHourInfoDto
.
setYearMonthDay
(
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
));
VehicleBookHourInfo
startVehicleBookHourInfo
=
vehicleBookHourInfoBiz
.
selectByVehicleAndId
(
vehicleBookHourInfoDto
);
vehicleBookHourInfoDto
.
setYearMonthDay
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()).
toString
(
DEFAULT_DATE_TIME_FORMATTER
));
VehicleBookHourInfo
endVehicleBookHourInfo
=
vehicleBookHourInfoBiz
.
selectByVehicleAndId
(
vehicleBookHourInfoDto
);
if
(
startVehicleBookHourInfo
!=
null
)
{
String
result
=
Integer
.
toBinaryString
(
startVehicleBookHourInfo
.
getBookedHour
());
if
(
StringUtils
.
isNotBlank
(
result
))
{
vehicleBookRecord
.
setStartHourList
(
getHourList
(
result
));
}
}
if
(
endVehicleBookHourInfo
!=
null
)
{
String
result
=
Integer
.
toBinaryString
(
endVehicleBookHourInfo
.
getBookedHour
());
if
(
StringUtils
.
isNotBlank
(
result
))
{
vehicleBookRecord
.
setEndHourList
(
getHourList
(
result
));
}
}
}
}
CompanyDetail
partCompany
=
branchCompanyBiz
.
getDetailById
(
vehicleAndModelInfoVo
.
getParkBranchCompanyId
());
CompanyDetail
partCompany
=
branchCompanyBiz
.
getDetailById
(
vehicleAndModelInfoVo
.
getParkBranchCompanyId
());
if
(
partCompany
!=
null
)
{
if
(
partCompany
!=
null
)
{
vehicleAndModelInfoVo
.
setParkCompanyName
(
partCompany
.
getName
());
vehicleAndModelInfoVo
.
setParkCompanyName
(
partCompany
.
getName
());
...
@@ -1115,4 +1210,27 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -1115,4 +1210,27 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
updateSelectiveById
(
vehicle
);
updateSelectiveById
(
vehicle
);
return
RestResponse
.
suc
();
return
RestResponse
.
suc
();
}
}
public
List
<
String
>
getHourList
(
String
result
)
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
if
(
result
.
length
()
<
24
)
{
//如果不足24位补0
for
(
int
i
=
0
;
i
<
24
-
result
.
length
();
i
++)
{
stringBuffer
.
append
(
"0"
);
}
log
.
info
(
stringBuffer
.
toString
());
}
stringBuffer
.
append
(
result
);
List
<
String
>
list
=
new
ArrayList
<>(
24
);
for
(
int
i
=
0
;
i
<
stringBuffer
.
toString
().
length
();
i
++)
{
if
(
"1"
.
equals
(
stringBuffer
.
toString
().
charAt
(
i
)+
""
))
{
list
.
add
(
i
,
"1"
);
}
else
{
list
.
add
(
i
,
"0"
);
}
}
return
list
;
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
View file @
d60de735
...
@@ -26,7 +26,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -26,7 +26,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartdate
,
String
bookEndDate
)
{
public
static
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartdate
,
String
bookEndDate
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
startDate
=
null
;
Date
startDate
=
null
;
Date
endDate
=
null
;
Date
endDate
=
null
;
...
@@ -50,7 +50,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -50,7 +50,7 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
int
endHour
=
new
DateTime
(
endDate
).
hourOfDay
().
get
();
int
endHour
=
new
DateTime
(
endDate
).
hourOfDay
().
get
();
//获取开始天的预定小时
//获取开始天的预定小时
int
startPredictableHour
=
0
;
int
startPredictableHour
=
0
;
for
(
int
curentHour
=
hour
;
curentHour
<
24
;
curentHour
++)
{
for
(
int
curentHour
=
hour
;
curentHour
<
=
24
;
curentHour
++)
{
startPredictableHour
|=
1
<<
(
curentHour
-
1
);
startPredictableHour
|=
1
<<
(
curentHour
-
1
);
}
}
//获取结束天的预定小时
//获取结束天的预定小时
...
@@ -60,10 +60,11 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -60,10 +60,11 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
}
}
predictableHours
.
put
(
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
startPredictableHour
);
predictableHours
.
put
(
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
startPredictableHour
);
predictableHours
.
put
(
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
endPredictableHour
);
predictableHours
.
put
(
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
endPredictableHour
);
DateTime
startDay
=
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
DATE_TIME_FORMATTER
);
if
(
startDay
.
getHourOfDay
()
-
endDay
.
getHourOfDay
()
>
1
){
//
for
(
DateTime
curDate
=
startDay
.
plusDays
(
1
);
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
if
(
endDay
.
getDayOfMonth
()
-
startDay
.
getDayOfMonth
()
>
1
){
//
for
(
DateTime
curDate
=
startDay
.
plusDays
(
1
);
curDate
.
compareTo
(
endDay
)
<
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
String
curDateStr
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
String
curDateStr
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
//全天预定
//全天预定
predictableHours
.
put
(
curDateStr
,
16777215
);
predictableHours
.
put
(
curDateStr
,
16777215
);
...
@@ -72,22 +73,13 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -72,22 +73,13 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
return
predictableHours
;
return
predictableHours
;
}
}
// public static void main(String[] args) {
public
List
<
VehicleBookHourInfo
>
selectByVehicleAndDate
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return
mapper
.
selectByVehicleAndDate
(
vehicleBookHourInfoDto
);
// Date startDate = null;
}
// Date endDate = null;
// try{
public
VehicleBookHourInfo
selectByVehicleAndId
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
// startDate = simpleDateFormat.parse("2019-06-21 16:30:30");
return
mapper
.
selectByVehicleAndId
(
vehicleBookHourInfoDto
);
// endDate = simpleDateFormat.parse("2019-06-22 12:30:30");
}
// }catch (Exception e) {
//
// }
// Map<String, Integer> map = getPredictableHours(startDate, endDate);
// for(Map.Entry<String, Integer> entry : map.entrySet()) {
// System.out.println(entry.getKey());
// System.out.println(entry.getValue());
// }
// }
@Transactional
@Transactional
public
ObjectRestResponse
save
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
public
ObjectRestResponse
save
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
...
@@ -102,13 +94,13 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -102,13 +94,13 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
return
ObjectRestResponse
.
createFailedResult
(
504
,
"当天时间段已经被预定"
);
return
ObjectRestResponse
.
createFailedResult
(
504
,
"当天时间段已经被预定"
);
}
else
{
}
else
{
vehicleBookHourInfo
.
setBookedHour
(
vehicleBookHourInfo
.
getBookedHour
()
|
vehicleBookHourInfoDto
.
getBookedHour
());
vehicleBookHourInfo
.
setBookedHour
(
vehicleBookHourInfo
.
getBookedHour
()
|
vehicleBookHourInfoDto
.
getBookedHour
());
mapper
.
updateByPrimaryKeySelectiv
e
(
vehicleBookHourInfo
);
updateSelectiveByIdR
e
(
vehicleBookHourInfo
);
}
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
//没有数据直接添加
//没有数据直接添加
mapper
.
insertSelectiv
e
(
vehicleBookHourInfoDto
);
insertSelectiveR
e
(
vehicleBookHourInfoDto
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
...
@@ -131,4 +123,19 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
...
@@ -131,4 +123,19 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
result
=
Integer
.
toBinaryString
(
16777200
);
String
newString
=
new
StringBuilder
(
result
).
reverse
().
toString
();
int
i
=
newString
.
length
()-
result
.
replace
(
"1"
,
""
).
length
();
System
.
out
.
println
(
i
);
Map
<
String
,
Integer
>
map
=
getPredictableHours
(
"2019-07-25 05:26:17"
,
"2019-07-27 15:26:17"
);
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
log
.
info
(
entry
.
getKey
());
log
.
info
(
entry
.
getValue
()
+
""
);
}
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
View file @
d60de735
...
@@ -57,6 +57,14 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
...
@@ -57,6 +57,14 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
@Autowired
@Autowired
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
public
void
save
(
VehicleBookRecord
vehicleBookRecord
)
{
insertSelectiveRe
(
vehicleBookRecord
);
}
public
int
changeRecordStatus
(
Map
<
String
,
Object
>
updateParam
)
{
return
mapper
.
changeRecordStatus
(
updateParam
);
}
public
QueryVehicleBookRecordVo
getById
(
Long
id
,
DateTime
endDate
)
throws
Exception
{
public
QueryVehicleBookRecordVo
getById
(
Long
id
,
DateTime
endDate
)
throws
Exception
{
Map
<
String
,
Object
>
recordParams
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
recordParams
=
Maps
.
newHashMap
();
recordParams
.
put
(
"id"
,
id
);
recordParams
.
put
(
"id"
,
id
);
...
@@ -156,6 +164,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
...
@@ -156,6 +164,9 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
return
PageDataVO
.
pageInfo
(
vehiclePageInfo
);
return
PageDataVO
.
pageInfo
(
vehiclePageInfo
);
}
}
/**
/**
* 获取相关申请记录对应随行物品的数量,并放入map
* 获取相关申请记录对应随行物品的数量,并放入map
* @param bookRecordAndVehicleInfos
* @param bookRecordAndVehicleInfos
...
@@ -329,6 +340,8 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
...
@@ -329,6 +340,8 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
}
public
PageDataVO
<
VehicleRecordInfoVo
>
getListByParam
(
VehiclePlanDto
vehiclePlanDto
)
{
public
PageDataVO
<
VehicleRecordInfoVo
>
getListByParam
(
VehiclePlanDto
vehiclePlanDto
)
{
Query
query
=
new
Query
(
vehiclePlanDto
);
Query
query
=
new
Query
(
vehiclePlanDto
);
PageDataVO
<
VehicleRecordInfoVo
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getByParam
(
query
.
getSuper
()));
PageDataVO
<
VehicleRecordInfoVo
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getByParam
(
query
.
getSuper
()));
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
View file @
d60de735
...
@@ -11,4 +11,6 @@ public interface VehicleBookHourInfoMapper extends Mapper<VehicleBookHourInfo> {
...
@@ -11,4 +11,6 @@ public interface VehicleBookHourInfoMapper extends Mapper<VehicleBookHourInfo> {
List
<
VehicleBookHourInfo
>
selectByVehicleAndDate
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
);
List
<
VehicleBookHourInfo
>
selectByVehicleAndDate
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
);
List
<
VehicleBookHourInfo
>
selectByVehicleAndDateList
(
Map
<
String
,
Object
>
param
);
List
<
VehicleBookHourInfo
>
selectByVehicleAndDateList
(
Map
<
String
,
Object
>
param
);
VehicleBookHourInfo
selectByVehicleAndId
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
);
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
d60de735
...
@@ -21,6 +21,7 @@ import com.xxfc.platform.vehicle.biz.VehicleWarningMsgBiz;
...
@@ -21,6 +21,7 @@ import com.xxfc.platform.vehicle.biz.VehicleWarningMsgBiz;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.constant.BookType
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus
;
import
com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
...
@@ -207,7 +208,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -207,7 +208,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
public
RestResponse
<
Integer
>
applyVehicle
(
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
public
RestResponse
<
Integer
>
applyVehicle
(
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
String
userName
=
BaseContextHandler
.
getName
();
baseBiz
.
applyVehicle
4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
baseBiz
.
applyVehicle
(
operatorId
,
bookVehicleVo
,
userName
);
return
RestResponse
.
suc
();
return
RestResponse
.
suc
();
}
}
...
@@ -400,7 +401,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -400,7 +401,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
BookVehicleVO
bookVehicleVo
=
BeanUtil
.
toBean
(
dto
,
BookVehicleVO
.
class
);
BookVehicleVO
bookVehicleVo
=
BeanUtil
.
toBean
(
dto
,
BookVehicleVO
.
class
);
dto
.
setLimit
(
1
);
dto
.
setLimit
(
1
);
dto
.
setPage
(
1
);
dto
.
setPage
(
1
);
bookVehicleVo
.
setBookType
(
BookType
.
USER_RENT
.
getCode
());
//查询可车辆信息
//查询可车辆信息
PageDataVO
<
Vehicle
>
pageDataVO
=
vehicleBiz
.
searchUsableVehicle
(
dto
);
PageDataVO
<
Vehicle
>
pageDataVO
=
vehicleBiz
.
searchUsableVehicle
(
dto
);
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
...
@@ -409,9 +410,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
...
@@ -409,9 +410,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
}});
}});
}
}
bookVehicleVo
.
setVehicleId
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
bookVehicleVo
.
setVehicleId
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
VehicleBookRecord
vehicleBookRecord
=
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
VehicleBookRecord
vehicleBookRecord
=
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
return
ObjectRestResponse
.
succ
(
vehicleBookRecord
);
return
ObjectRestResponse
.
succ
(
vehicleBookRecord
);
}
}
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
View file @
d60de735
...
@@ -17,7 +17,10 @@
...
@@ -17,7 +17,10 @@
select * from vehicle_book_hour_info
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day = #{yearMonthDay}
where vehicle_id = #{vehicleId} and year_month_day = #{yearMonthDay}
</select>
</select>
<select
id=
"selectByVehicleAndId"
parameterType=
"com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and book_record_id = #{bookRecordId} and year_month_day = #{yearMonthDay}
</select>
<select
id=
"selectByVehicleAndDateList"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
<select
id=
"selectByVehicleAndDateList"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day in
where vehicle_id = #{vehicleId} and year_month_day in
...
...
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