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
294fefbf
Commit
294fefbf
authored
Aug 13, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
1077735a
c82d506b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
91 additions
and
45 deletions
+91
-45
ResultCode.java
...thub/wxiaoqi/security/common/util/process/ResultCode.java
+21
-0
resultcod.properties
...common/src/main/resources/properties/resultcod.properties
+23
-0
UserController.java
...om/github/wxiaoqi/security/admin/rest/UserController.java
+6
-5
OrderRefundBiz.java
...main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
+1
-1
BackStageOrderController.java
...om/xxfc/platform/order/rest/BackStageOrderController.java
+1
-1
TourGoodController.java
.../java/com/xxfc/platform/tour/rest/TourGoodController.java
+1
-1
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
+24
-23
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.
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/ResultCode.java
View file @
294fefbf
...
...
@@ -23,6 +23,27 @@ public class ResultCode {
// 预定时间不能小于当前时间
public
static
int
ONLY_BOOK_FROM_TODAY
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"ONLY_BOOK_FROM_TODAY"
));
// 只能预定两个月内的车辆
public
static
int
ONLY_BOOK_TWO_MONTH
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"ONLY_BOOK_TWO_MONTH"
));
// 只能取消预定两个月内的车辆
public
static
int
ONLY_UNBOOK_TWO_MONTH
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"ONLY_UNBOOK_TWO_MONTH"
));
// 添加车辆太多
public
static
int
ADD_VEHICLE_MORE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"ADD_VEHICLE_MORE"
));
// 停靠公司不能为空
public
static
int
RET_COMPANY_CAN_NOT_BE_NULL
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"RET_COMPANY_CAN_NOT_BE_NULL"
));
// 车牌不能为空
public
static
int
NUMBER_PLAT_CAN_NOT_BE_NULL
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"NUMBER_PLAT_CAN_NOT_BE_NULL"
));
// 选择日期不可取消预定
public
static
int
VEHICLE_CAN_NOT_UNBOOK
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"VEHICLE_CAN_NOT_UNBOOK"
));
//预定日期为空
public
static
int
BOOKED_DATE_IS_EMPTY
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"BOOKED_DATE_IS_EMPTY"
));
public
static
int
TODAY_CAN_NOT_BOOK
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"TODAY_CAN_NOT_BOOK"
));
// 添加车辆失败,请重试
public
static
int
ADD_VEHICLE_FAIL
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"ADD_VEHICLE_FAIL"
));
...
...
ace-common/src/main/resources/properties/resultcod.properties
View file @
294fefbf
...
...
@@ -225,3 +225,26 @@ UPDATE_VEHICLE_FAIL = 4010
DATE_TIME_IS_NULL
=
4011
4011
=
预定时间不能为空
ONLY_BOOK_TWO_MONTH
=
4012
4012
=
只能预定两月内的车辆
ONLY_UNBOOK_TWO_MONTH
=
4013
4013
=
只能取消预定两月内的车辆
VEHICLE_CAN_NOT_UNBOOK
=
4014
4014
=
选择日期不可取消预定
BOOKED_DATE_IS_EMPTY
=
4015
4015
=
预定日期为空
TODAY_CAN_NOT_BOOK
=
4016
4016
=
当天不可预定
ADD_VEHICLE_MORE
=
4017
4017
=
添加车辆过多,请分批添加
RET_COMPANY_CAN_NOT_BE_NULL
=
4018
4018
=
停靠公司不能为空
NUMBER_PLAT_CAN_NOT_BE_NULL
=
4019
4019
=
车牌不能为空
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/UserController.java
View file @
294fefbf
...
...
@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
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.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -78,13 +79,13 @@ public class UserController extends CommonBaseController {
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()
>
0
)
{
throw
new
RuntimeException
(
"用户名不能重复"
);
}
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
()
);
}
}
userBiz
.
insertSelective
(
vo
);
//添加权限关系
groupBiz
.
modifyUserGroups
(
vo
.
getId
(),
vo
.
getMembers
());
return
new
ObjectRestResponse
();
return
ObjectRestResponse
.
succ
();
}
private
void
handleDataLimit
(
@RequestBody
UserVO
dto
)
{
...
...
@@ -166,12 +167,12 @@ public class UserController extends CommonBaseController {
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()
>
1
)
{
throw
new
RuntimeException
(
"用户名不能重复"
);
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
()
);
}
if
(
list
.
size
()
==
1
)
{
User
user
=
list
.
get
(
0
);
if
(!
user
.
getId
().
equals
(
vo
.
getId
()))
{
throw
new
RuntimeException
(
"用户名不能重复"
);
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
()
);
}
}
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
View file @
294fefbf
...
...
@@ -110,7 +110,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
String
refundDesc
=
"退还押金:"
+
refundAmont
.
toString
()+
"(已扣除 违章预备金:"
+
illegalReserve
.
toString
();
try
{
if
(
null
!=
crosstown
.
getDedDetail
())
{
List
<
DedDetailDTO
>
dddList
=
JSONUtil
.
to
Bean
(
crosstown
.
getDedDetail
(),
List
.
class
);
List
<
DedDetailDTO
>
dddList
=
JSONUtil
.
to
List
(
JSONUtil
.
parseArray
(
crosstown
.
getDedDetail
()),
DedDetailDTO
.
class
);
for
(
DedDetailDTO
ddd
:
dddList
)
{
refundDesc
+=
", "
+
ddd
.
getDeductions
()+
":"
+
ddd
.
getCost
();
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BackStageOrderController.java
View file @
294fefbf
...
...
@@ -98,7 +98,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
ObjectRestResponse
<
List
<
AppUserVo
>>
objectRestResponse
=
userFeign
.
getByUserIds
(
userIds
);
log
.
info
(
"获取用户信息:objectRestResponse = {}"
,
objectRestResponse
.
getData
());
Map
<
String
,
AppUserVo
>
appUserVoMap
=
objectRestResponse
.
getData
()
==
null
?
new
HashMap
<
String
,
AppUserVo
>()
:
objectRestResponse
.
getData
().
parallelStream
().
collect
(
Collectors
.
toMap
(
v
->
v
.
getUserid
()
.
toString
().
trim
()
,
v
->
v
));
:
objectRestResponse
.
getData
().
parallelStream
().
collect
(
Collectors
.
toMap
(
v
->
v
.
getUserid
()
==
null
?
""
:
v
.
getUserid
()
+
""
,
v
->
v
));
for
(
OrderListVo
orderPageVO
:
list
)
{
AppUserVo
appUserVo
=
appUserVoMap
.
get
(
orderPageVO
.
getUserId
().
toString
());
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodController.java
View file @
294fefbf
...
...
@@ -36,7 +36,7 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
@RequestParam
(
value
=
"page"
,
required
=
true
)
Integer
page
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
value
=
"query"
,
required
=
false
)
String
query
,
@RequestParam
(
value
=
"latitude"
,
required
=
false
)
Double
latitude
,
@RequestParam
(
value
=
"longitude"
,
required
=
false
)
Double
longitude
,
@RequestParam
(
value
=
"tagId"
,
required
=
false
)
Integer
tagId
,
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"
0.
00"
)
Double
distance
)
{
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"
1
00"
)
Double
distance
)
{
return
baseBiz
.
getGoodList
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
}
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/constant/ResCode/ResCode.java
View file @
294fefbf
...
...
@@ -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 @
294fefbf
...
...
@@ -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 @
294fefbf
...
...
@@ -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 @
294fefbf
...
...
@@ -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
);
...
...
@@ -830,7 +830,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)<=
0
;
curDate
=
curDate
.
plusDays
(
1
)){
String
curDateStr
=
curDate
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
if
(
curDateStr
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))<
0
){
throw
new
CustomIllegalParamException
(
"只可以取消当前时间之后的车辆"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
}
String
curYearMonth
=
curDate
.
toString
(
YEARMONTH_DATE_TIME_FORMATTER
);
if
(!
yearMonthAndDate
.
containsKey
(
curYearMonth
)){
...
...
@@ -841,7 +841,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
CustomIllegalParamException
(
" 只可以预约两个月内的车辆"
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
}
...
...
@@ -860,7 +860,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_UNBOOK_TWO_MONTH
);
}
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
...
...
@@ -881,7 +881,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
unbookDates
)){
throw
new
CustomIllegalParamException
(
" 车辆不可预定"
);
throw
new
BaseException
(
ResultCode
.
VEHICLE_CAN_NOT_UNBOOK
);
}
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
new
HashMap
<>();
yearMonthAndDate
.
put
(
yearMonth
,
unbookDates
);
...
...
@@ -908,7 +908,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public
void
fillBookedDateSearchParam
(
Map
<
String
,
Object
>
params
,
Map
<
String
,
List
<
String
>>
yearMonthAndDate
,
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
){
if
(
MapUtils
.
isEmpty
(
yearMonthAndDate
)&&
MapUtils
.
isEmpty
(
yearMonthAndDateNotBooked
)){
//没有预定信息查询条件
throw
new
CustomIllegalParamException
(
"没有预订信息!"
);
throw
new
BaseException
(
ResultCode
.
BOOKED_DATE_IS_EMPTY
);
}
Map
<
String
,
Map
<
String
,
Integer
>>
yearMonthAndParam
=
new
HashMap
<>();
...
...
@@ -953,7 +953,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
for
(
String
dateStr:
entry
.
getValue
())
{
//已预定作为条件,该位与1作与运算必定为1
if
(
bookedYearMonth
.
contains
(
dateStr
)){
throw
new
CustomIllegalParamException
(
"同一天既作为未预定查询条件又作为已预定查询条件"
);
log
.
info
(
"当天不可预定,日期为:dateStr = {}"
,
dateStr
);
throw
new
BaseException
(
ResultCode
.
TODAY_CAN_NOT_BOOK
);
}
DateTime
dateTime
=
DateTime
.
parse
(
dateStr
,
DEFAULT_DATE_TIME_FORMATTER
);
//仅对应位为1的整形值
...
...
@@ -1042,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 @
294fefbf
...
...
@@ -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 @
294fefbf
...
...
@@ -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