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
9a521569
Commit
9a521569
authored
Aug 13, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改租車訂單地址,修改车辆预定时添加订单号
parent
db119a26
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
31 deletions
+31
-31
ResCode.java
...a/com/xxfc/platform/vehicle/constant/ResCode/ResCode.java
+1
-0
ConstantBiz.java
.../main/java/com/xxfc/platform/vehicle/biz/ConstantBiz.java
+6
-6
SysRegionBiz.java
...main/java/com/xxfc/platform/vehicle/biz/SysRegionBiz.java
+2
-2
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+17
-17
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+4
-4
VehicleBookRecordBiz.java
...a/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
+1
-2
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/constant/ResCode/ResCode.java
View file @
9a521569
...
...
@@ -53,6 +53,7 @@ public enum ResCode {
ORDER_DETAIL_IS_NOT_EXIST
(
10001
,
"订单详情不可查询"
),
YOU_AUTH_FAIL
(-
2
,
"无权限查看此信息"
),
ORDER_IS_NOT_PAY
(
10002
,
"订单未支付"
),
USER_IS_EXIST
(
10003
,
"用户名已存在"
);
;
/**
* 返回码
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/ConstantBiz.java
View file @
9a521569
...
...
@@ -2,9 +2,9 @@ package com.xxfc.platform.vehicle.biz;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.constant.ConstantType
;
import
com.xxfc.platform.vehicle.constant.RedisKey
;
import
com.xxfc.platform.vehicle.entity.Constant
;
...
...
@@ -159,7 +159,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return
Boolean
.
FALSE
;
}
if
(
constants
.
size
()>
MAX_BATCH_SIZE_CONSTANT_UPDATE
){
throw
new
IllegalArgument
Exception
(
" exceed max batch size"
);
throw
new
Base
Exception
(
" exceed max batch size"
);
}
return
Boolean
.
TRUE
;
...
...
@@ -198,7 +198,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return
0
;
}
if
(
codes
.
size
()>
MAX_BATCH_SIZE_CONSTANT_UPDATE
){
throw
new
IllegalArgument
Exception
(
" exceed max batch size"
);
throw
new
Base
Exception
(
" exceed max batch size"
);
}
List
<
String
>
delCodes
=
Lists
.
newArrayList
();
for
(
Integer
code:
codes
){
...
...
@@ -242,12 +242,12 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
*/
public
Boolean
checkIfExists
(
Integer
type
,
Integer
code
){
if
(!
ConstantType
.
exists
(
type
)){
throw
new
CustomIllegalParam
Exception
(
" no such type of constant"
);
throw
new
Base
Exception
(
" no such type of constant"
);
}
List
<
ConstantVo
>
constantVoList
=
getAllConstantByType
(
type
);
if
(
CollectionUtils
.
isEmpty
(
constantVoList
)){
throw
new
CustomIllegalParam
Exception
(
" no such code of constant in relative type"
);
throw
new
Base
Exception
(
" no such code of constant in relative type"
);
}
for
(
ConstantVo
constantVo:
constantVoList
){
...
...
@@ -255,7 +255,7 @@ public class ConstantBiz extends BaseBiz<ConstantMapper,Constant> {
return
Boolean
.
TRUE
;
}
}
throw
new
CustomIllegalParam
Exception
(
" no such code of constant in relative type"
);
throw
new
Base
Exception
(
" no such code of constant in relative type"
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/SysRegionBiz.java
View file @
9a521569
...
...
@@ -3,8 +3,8 @@ package com.xxfc.platform.vehicle.biz;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.constant.RedisKey
;
import
com.xxfc.platform.vehicle.constant.RegionType
;
import
com.xxfc.platform.vehicle.entity.SysRegion
;
...
...
@@ -42,7 +42,7 @@ public class SysRegionBiz extends BaseBiz<SysRegionMapper, SysRegion> {
public
List
<
SysRegion
>
getRegionsByCodes
(
List
<
Long
>
ids
){
List
<
String
>
redisCacheKeys
=
Lists
.
newArrayList
();
if
(
CollectionUtils
.
isEmpty
(
ids
)){
throw
new
CustomIllegalParam
Exception
(
"empty id list"
);
throw
new
Base
Exception
(
"empty id list"
);
}
for
(
Long
id:
ids
){
redisCacheKeys
.
add
(
RedisKey
.
SYS_REGION_CACHE_PREFIX
+
id
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
9a521569
...
...
@@ -208,7 +208,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public
RestResponse
add
(
List
<
AddOrUpdateVehicleVo
>
addOrUpdateVehicleVoList
)
throws
Exception
{
if
(
addOrUpdateVehicleVoList
.
size
()>
MAX_BATCH_SIZE_VEHICLE
){
throw
new
CustomIllegalParamException
(
"添加的车辆数量过多!"
);
throw
new
BaseException
(
ResultCode
.
ADD_VEHICLE_MORE
);
}
for
(
AddOrUpdateVehicleVo
addOrUpdateVehicleVo:
addOrUpdateVehicleVoList
)
{
...
...
@@ -217,7 +217,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
BeanUtilsBean
.
getInstance
().
copyProperties
(
vehicle
,
addOrUpdateVehicleVo
);
if
(
addOrUpdateVehicleVo
.
getParkBranchCompanyId
()==
null
)
{
throw
new
CustomIllegalParamException
(
"停靠公司不能为空"
);
throw
new
BaseException
(
ResultCode
.
RET_COMPANY_CAN_NOT_BE_NULL
);
}
vehicle
.
setId
(
UUID
.
randomUUID
().
toString
());
...
...
@@ -251,7 +251,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
// }
if
(
addOrUpdateVehicleVo
.
getNumberPlate
()
==
null
){
throw
new
CustomIllegalParamException
(
"车牌不能为空"
);
throw
new
BaseException
(
ResultCode
.
NUMBER_PLAT_CAN_NOT_BE_NULL
);
}
List
<
Vehicle
>
vehicles
=
mapper
.
lockByCode
(
addOrUpdateVehicleVo
);
return
vehicles
;
...
...
@@ -265,14 +265,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
@Transactional
public
RestResponse
update
(
List
<
AddOrUpdateVehicleVo
>
addOrUpdateVehicleVoList
)
throws
Exception
{
if
(
addOrUpdateVehicleVoList
.
size
()>
MAX_BATCH_SIZE_VEHICLE
){
throw
new
CustomIllegalParamException
(
"exceed max batch size"
);
throw
new
BaseException
(
ResultCode
.
ADD_VEHICLE_MORE
);
}
for
(
AddOrUpdateVehicleVo
addOrUpdateVehicleVo:
addOrUpdateVehicleVoList
){
Vehicle
vehicle
=
new
Vehicle
();
BeanUtilsBean
.
getInstance
().
copyProperties
(
vehicle
,
addOrUpdateVehicleVo
);
if
(
addOrUpdateVehicleVo
.
getParkBranchCompanyId
()==
null
)
{
throw
new
CustomIllegalParamException
(
"Stop at branch office cannot be empty"
);
throw
new
BaseException
(
ResultCode
.
RET_COMPANY_CAN_NOT_BE_NULL
);
}
//悲观锁,检查是否已存在车牌或编码
...
...
@@ -305,7 +305,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
*/
public
RestResponse
discard
(
List
<
String
>
idList
){
if
(
idList
.
size
()>
MAX_BATCH_SIZE_VEHICLE
){
throw
new
CustomIllegalParamException
(
"exceed max batch size"
);
throw
new
BaseException
(
ResultCode
.
ADD_VEHICLE_MORE
);
}
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"idList"
,
idList
);
...
...
@@ -341,7 +341,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
());
...
...
@@ -427,7 +427,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" 只可以预约两个月内的车辆"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
//检查车辆是否可以预定
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
...
...
@@ -470,7 +470,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
throw
new
BaseException
(
"车辆预定失败"
);
throw
new
BaseException
(
ResultCode
.
BOOKED_FAILED_CODE
);
}
//添加随车物品
...
...
@@ -511,7 +511,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" 只可以预约两个月内的车辆"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
());
...
...
@@ -607,7 +607,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookRecordId
);
//申请记录验证
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
return
RestResponse
.
codeAndMessage
(
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getCode
(),
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getDesc
()
);
}
if
(!
VehicleBookRecordStatus
.
APPLY
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
())){
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
...
...
@@ -663,7 +663,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookRecordId
);
//申请记录验证
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
return
RestResponse
.
codeAndMessage
(
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getCode
(),
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getDesc
()
);
}
//已通过审核的可以取消预定
if
(!
VehicleBookRecordStatus
.
APPROVE
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
())){
...
...
@@ -679,7 +679,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//取消预定
Boolean
hasSuc
=
unbookVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
throw
new
IllegalArgumentException
(
" invalid book record "
);
return
RestResponse
.
codeAndMessage
(
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getCode
(),
ResCode
.
VEHICLE_BOOK_RECORD_IS_NOT_EXIST
.
getDesc
()
);
}
//修改预定状态,写入取消人
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
...
...
@@ -751,7 +751,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" 只可以预约两个月内的车辆"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
...
...
@@ -789,7 +789,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
bookedDates
)){
throw
new
CustomIllegalParamException
(
" there are no day to book"
);
throw
new
BaseException
(
ResultCode
.
BOOKED_DATE_IS_EMPTY
);
}
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
new
HashMap
<>();
yearMonthAndDate
.
put
(
vehicleBookInfo
.
getYearMonth
(),
bookedDates
);
...
...
@@ -1043,10 +1043,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//未预定年月 - 未预定日期列表
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
if
(
allYearMonth
.
size
()>
0
&&
params
.
get
(
"subordinateBranch"
)
==
null
){
throw
new
CustomIllegalParam
Exception
(
" <subordinateBranch> must included in params while using <bookedInfo> param. "
);
throw
new
Base
Exception
(
" <subordinateBranch> must included in params while using <bookedInfo> param. "
);
}
if
(
allYearMonth
.
size
()>
MAX_MONTH_COUNT_BOOKED_INFO_QUERY
){
throw
new
CustomIllegalParam
Exception
(
" only 3 month can be included <bookedInfo> param."
);
throw
new
Base
Exception
(
" only 3 month can be included <bookedInfo> param."
);
}
//加入预定信息查询条件
fillBookedDateSearchParam
(
params
,
yearMonthAndDate
,
yearMonthAndDateNotBooked
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
View file @
9a521569
...
...
@@ -3,10 +3,10 @@ package com.xxfc.platform.vehicle.biz;
import
com.ace.cache.annotation.Cache
;
import
com.ace.cache.annotation.CacheClear
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper
;
...
...
@@ -39,15 +39,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
startDate
=
simpleDateFormat
.
parse
(
bookStartDate
);
endDate
=
simpleDateFormat
.
parse
(
bookEndDate
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
//判定时间是否合法
if
(
bookStartDate
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))
<
0
)
{
throw
new
CustomIllegalParamException
(
ResultCode
.
getMsg
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
)
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
if
(
bookStartDate
.
compareTo
(
bookEndDate
)
>
0
)
{
throw
new
CustomIllegalParamException
(
"预定开始日期不能大于结束日期!"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
Map
<
String
,
Integer
>
predictableHours
=
Maps
.
newHashMap
();
//预定开始小时
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
View file @
9a521569
...
...
@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.constant.BookType
;
import
com.xxfc.platform.vehicle.constant.RedisKey
;
...
...
@@ -273,7 +272,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if
(
params
.
get
(
"selectedMonth"
)
!=
null
)
{
String
selectedMonth
=
(
String
)
params
.
get
(
"selectedMonth"
);
if
(
StringUtils
.
isBlank
(
selectedMonth
)){
throw
new
CustomIllegalParamException
(
"
no month selected "
);
throw
new
BaseException
(
"
no month selected "
);
}
DateTime
selectedMonthDate
=
DateTime
.
parse
(
selectedMonth
,
YEARMONTH_DATE_TIME_FORMATTER
);
if
(
selectedMonthDate
.
compareTo
(
DateTime
.
now
().
plusMonths
(-
1
).
withDayOfMonth
(
1
).
withMillisOfDay
(
0
))
<
0
){
...
...
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