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
ef6943dc
Commit
ef6943dc
authored
Aug 13, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
修改租車訂單地址,修改车辆预定时添加订单号
parents
120d1204
fb35e713
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
29 deletions
+52
-29
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+48
-21
VehicleBookRecordBiz.java
...a/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
+1
-1
VehicleCataController.java
...com/xxfc/platform/vehicle/rest/VehicleCataController.java
+3
-7
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
ef6943dc
...
@@ -603,6 +603,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -603,6 +603,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
*/
*/
@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
{
try
{
//获取相关申请记录
//获取相关申请记录
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookRecordId
);
VehicleBookRecord
vehicleBookRecord
=
vehicleBookRecordBiz
.
selectById
(
bookRecordId
);
//申请记录验证
//申请记录验证
...
@@ -633,24 +634,31 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -633,24 +634,31 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
// }
// }
// vehicleBookHourInfoBiz.delete(vehicleBookRecord.getVehicleId(),list);
// vehicleBookHourInfoBiz.delete(vehicleBookRecord.getVehicleId(),list);
// }
// }
//成功后修改预定记录状态
//成功后修改预定记录状态
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
updateParam
.
put
(
"id"
,
bookRecordId
);
updateParam
.
put
(
"id"
,
bookRecordId
);
updateParam
.
put
(
"status"
,
rsStatus
);
updateParam
.
put
(
"status"
,
rsStatus
);
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
=
vehicleBookRecordBiz
.
changeRecordStatus
(
updateParam
);
Integer
effected
=
vehicleBookRecordBiz
.
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
());
}
else
if
(
VehicleBookRecordStatus
.
REJECTED
.
getCode
().
equals
(
rsStatus
)){
}
else
if
(
VehicleBookRecordStatus
.
REJECTED
.
getCode
().
equals
(
rsStatus
)){
//拒绝,则释放bookinfo
//拒绝,则释放bookinfo
bookVehicleVo
.
setUnbookStartDate
(
bookVehicleVo
.
getBookStartDate
());
bookVehicleVo
.
setUnbookStartDate
(
bookVehicleVo
.
getBookStartDate
());
bookVehicleVo
.
setUnbookEndDate
(
bookVehicleVo
.
getBookEndDate
());
bookVehicleVo
.
setUnbookEndDate
(
bookVehicleVo
.
getBookEndDate
());
Boolean
hasSuc
=
unbookVehicle
(
bookVehicleVo
);
Boolean
hasSuc
=
unbookVehicle
(
bookVehicleVo
);
if
(
hasSuc
)
{
return
RestResponse
.
suc
();
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
RestResponse
.
codeAndMessage
(
1325
,
e
.
getMessage
());
}
}
return
RestResponse
.
suc
(
);
return
RestResponse
.
codeAndMessage
(
1325
,
"取消预定失败"
);
}
}
/**
/**
...
@@ -840,6 +848,25 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -840,6 +848,25 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
curBookedDateList
.
add
(
curDateStr
);
curBookedDateList
.
add
(
curDateStr
);
}
}
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
" 只可以预约两个月内的车辆"
);
}
}
private
void
uinbookDateList4DatePeriod
(
Map
<
String
,
List
<
String
>>
yearMonthAndDate
,
DateTime
startDay
,
DateTime
endDay
){
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 BaseException("只可以取消当前时间之后的车辆");
// }
String
curYearMonth
=
curDate
.
toString
(
YEARMONTH_DATE_TIME_FORMATTER
);
if
(!
yearMonthAndDate
.
containsKey
(
curYearMonth
)){
yearMonthAndDate
.
put
(
curYearMonth
,
Lists
.
newArrayList
());
}
List
<
String
>
curBookedDateList
=
yearMonthAndDate
.
get
(
curYearMonth
);
curBookedDateList
.
add
(
curDateStr
);
}
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
}
...
@@ -850,14 +877,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -850,14 +877,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @return
* @return
*/
*/
@Transactional
@Transactional
public
Boolean
unbookVehicle
(
BookVehicleVO
bookVehicleVo
){
public
Boolean
unbookVehicle
(
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
//提取日期参数,改为每月一份
//提取日期参数,改为每月一份
//提取日期和相应的预定目标日期
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
//转换日期范围为列表,并检查是否合法
fill
DateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
uinbook
DateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_UNBOOK_TWO_MONTH
);
throw
new
BaseException
(
ResultCode
.
ONLY_UNBOOK_TWO_MONTH
);
...
@@ -1142,7 +1169,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -1142,7 +1169,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//需比较未预定的年月 - 未预定日期列表 "2019-08-29"...."2019-09-04",
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//需比较未预定的年月 - 未预定日期列表 "2019-08-29"...."2019-09-04",
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
if
(
allYearMonth
.
size
()>
MAX_MONTH_COUNT_BOOKED_INFO_QUERY
){
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."
);
}
}
//加入预定信息查询条件
//加入预定信息查询条件
...
@@ -1168,7 +1195,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -1168,7 +1195,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//未预定年月 - 未预定日期列表
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//未预定年月 - 未预定日期列表
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
if
(
allYearMonth
.
size
()>
MAX_MONTH_COUNT_BOOKED_INFO_QUERY
){
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
);
fillBookedDateSearchParam
(
params
,
yearMonthAndDate
,
yearMonthAndDateNotBooked
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
View file @
ef6943dc
...
@@ -272,7 +272,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
...
@@ -272,7 +272,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if
(
params
.
get
(
"selectedMonth"
)
!=
null
)
{
if
(
params
.
get
(
"selectedMonth"
)
!=
null
)
{
String
selectedMonth
=
(
String
)
params
.
get
(
"selectedMonth"
);
String
selectedMonth
=
(
String
)
params
.
get
(
"selectedMonth"
);
if
(
StringUtils
.
isBlank
(
selectedMonth
)){
if
(
StringUtils
.
isBlank
(
selectedMonth
)){
throw
new
BaseException
(
"no month selected "
);
throw
new
BaseException
(
"
no month selected "
);
}
}
DateTime
selectedMonthDate
=
DateTime
.
parse
(
selectedMonth
,
YEARMONTH_DATE_TIME_FORMATTER
);
DateTime
selectedMonthDate
=
DateTime
.
parse
(
selectedMonth
,
YEARMONTH_DATE_TIME_FORMATTER
);
if
(
selectedMonthDate
.
compareTo
(
DateTime
.
now
().
plusMonths
(-
1
).
withDayOfMonth
(
1
).
withMillisOfDay
(
0
))
<
0
){
if
(
selectedMonthDate
.
compareTo
(
DateTime
.
now
().
plusMonths
(-
1
).
withDayOfMonth
(
1
).
withMillisOfDay
(
0
))
<
0
){
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleCataController.java
View file @
ef6943dc
...
@@ -9,16 +9,12 @@ import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
...
@@ -9,16 +9,12 @@ import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.common.VehicleBaseController
;
import
com.xxfc.platform.vehicle.common.VehicleBaseController
;
import
com.xxfc.platform.vehicle.entity.VehiclePlatCata
;
import
com.xxfc.platform.vehicle.entity.VehiclePlatCata
;
import
com.xxfc.platform.vehicle.pojo.
*
;
import
com.xxfc.platform.vehicle.pojo.
Cascade
;
import
lombok.Data
;
import
com.xxfc.platform.vehicle.pojo.CataVo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Update
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
sun.java2d.pipe.AATextRenderer
;
import
java.util.Arrays
;
@RestController
@RestController
@RequestMapping
(
"/cata"
)
@RequestMapping
(
"/cata"
)
...
@@ -225,7 +221,7 @@ public class VehicleCataController extends VehicleBaseController<VehiclePlatCata
...
@@ -225,7 +221,7 @@ public class VehicleCataController extends VehicleBaseController<VehiclePlatCata
return RestResponse.data(baseBiz.getByPage(vehiclePageQueryVo));
return RestResponse.data(baseBiz.getByPage(vehiclePageQueryVo));
} catch (JSONException ex) {
} catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (
CustomIllegalParam
Exception ex) {
} catch (
Base
Exception ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
}
}*/
}*/
...
...
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