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
7de4f6a2
Commit
7de4f6a2
authored
Sep 23, 2020
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-vehicle-price' into dev-tiande
parents
ec83214a
da3f7d61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
68 deletions
+108
-68
BgShuntApplyController.java
...latform/order/rest/background/BgShuntApplyController.java
+108
-68
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/background/BgShuntApplyController.java
View file @
7de4f6a2
...
@@ -75,76 +75,79 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
...
@@ -75,76 +75,79 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
@RequestMapping
(
value
=
"/steward/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/steward/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"根据城市查询待确认申请列表"
)
@ApiOperation
(
value
=
"根据城市查询待确认申请列表"
)
public
ObjectRestResponse
<
List
<
StewardShuntApply
>>
stewardList
(
ListDTO
dto
)
{
public
ObjectRestResponse
<
PageDataVO
<
StewardShuntApply
>>
stewardList
(
ListDTO
dto
)
{
//获取该城市的申请最大和最小时间
//获取该城市的申请最大和最小时间
//获取该店铺
//获取该店铺
List
<
ShuntApply
>
list
=
baseBiz
.
selectByWeekend
(
w
->
{
PageDataVO
<
ShuntApply
>
list
=
PageDataVO
.
pageInfo
(
dto
.
initQuery
(),
()
->
baseBiz
.
selectByWeekend
(
w
->
{
if
(
null
!=
dto
.
getCityCode
())
{
w
.
andEqualTo
(
ShuntApply:
:
getStartCityCode
,
dto
.
getCityCode
());
w
.
andEqualTo
(
ShuntApply:
:
getStartCityCode
,
dto
.
getCityCode
());
}
w
.
andEqualTo
(
ShuntApply:
:
getStatus
,
STATUS_CRT
);
w
.
andEqualTo
(
ShuntApply:
:
getStatus
,
STATUS_CRT
);
return
w
;
return
w
;
},
" crt_time desc "
);
},
" crt_time desc "
),
StewardShuntApply
.
class
);
List
<
StewardShuntApply
>
returnList
=
CollUtil
.
newArrayList
();
// List<StewardShuntApply> returnList = CollUtil.newArrayList();
Integer
companyId
=
getAdminUserInfo
().
getCompanyId
();
//
// Integer companyId = getAdminUserInfo().getCompanyId();
if
(
CollUtil
.
isNotEmpty
(
list
))
{
//
//group by 车型
// if(CollUtil.isNotEmpty(list)) {
//List<Integer> modelList = list.parallelStream().map(ShuntApply::getModelId).distinct().collect(Collectors.toList());
// //group by 车型
//.collect(Collectors.groupingBy(ShuntApply::getModelId));
// //List<Integer> modelList = list.parallelStream().map(ShuntApply::getModelId).distinct().collect(Collectors.toList());
Map
<
Integer
,
List
<
ShuntApply
>>
modelMap
=
list
.
parallelStream
().
collect
(
Collectors
.
groupingBy
(
ShuntApply:
:
getModelId
));
// //.collect(Collectors.groupingBy(ShuntApply::getModelId));
// Map<Integer, List<ShuntApply>> modelMap = list.parallelStream().collect(Collectors.groupingBy(ShuntApply::getModelId));
Long
startTime
=
list
.
parallelStream
().
map
(
ShuntApply:
:
getStartTime
).
min
(
Long:
:
compareTo
).
get
();
//
Long
endTime
=
list
.
parallelStream
().
map
(
ShuntApply:
:
getEndTime
).
max
(
Long:
:
compareTo
).
get
();
// Long startTime = list.parallelStream().map(ShuntApply::getStartTime).min(Long::compareTo).get();
// Long endTime = list.parallelStream().map(ShuntApply::getEndTime).max(Long::compareTo).get();
for
(
Integer
modelId
:
modelMap
.
keySet
())
{
//
RentVehicleBookDTO
rbd
=
new
RentVehicleBookDTO
();
// for (Integer modelId : modelMap.keySet()) {
rbd
.
setModelId
(
modelId
);
// RentVehicleBookDTO rbd = new RentVehicleBookDTO();
rbd
.
setParkBranchCompanyId
(
companyId
);
// rbd.setModelId(modelId);
rbd
.
setStartCompanyId
(
companyId
);
// rbd.setParkBranchCompanyId(companyId);
rbd
.
setEndCompanyId
(
companyId
);
// rbd.setStartCompanyId(companyId);
rbd
.
setBookStartDate
(
DateUtil
.
date
(
startTime
).
toDateStr
());
// rbd.setEndCompanyId(companyId);
rbd
.
setBookEndDate
(
DateUtil
.
date
(
endTime
).
toDateStr
());
// rbd.setBookStartDate(DateUtil.date(startTime).toDateStr());
rbd
.
setBookStartDateTime
(
DateUtil
.
date
(
startTime
).
toTimeStr
());
// rbd.setBookEndDate(DateUtil.date(endTime).toDateStr());
rbd
.
setBookEndDateTime
(
DateUtil
.
date
(
endTime
).
toTimeStr
());
// rbd.setBookStartDateTime(DateUtil.date(startTime).toTimeStr());
//查询本公司时间段内可用车辆
// rbd.setBookEndDateTime(DateUtil.date(endTime).toTimeStr());
ObjectRestResponse
<
PageDataVO
<
UsableVeicleVO
>>
usableVehiclePage
=
vehicleFeign
.
applyUsableVehicle
(
rbd
);
// //查询本公司时间段内可用车辆
// ObjectRestResponse<PageDataVO<UsableVeicleVO>> usableVehiclePage = vehicleFeign.applyUsableVehicle(rbd);
if
(
CollUtil
.
isNotEmpty
(
usableVehiclePage
.
getData
().
getData
()))
{
//
modelMap
.
get
(
modelId
).
forEach
(
shuntApply
->
{
// if(CollUtil.isNotEmpty(usableVehiclePage.getData().getData())) {
List
<
UsableVeicleVO
>
vehicles
=
CollUtil
.
newArrayList
();
// modelMap.get(modelId).forEach( shuntApply -> {
// List<UsableVeicleVO> vehicles = CollUtil.newArrayList();
usableVehiclePage
.
getData
().
getData
().
forEach
(
usableVeicleVO
->
{
//
//判断是否预定时间内可租
// usableVehiclePage.getData().getData().forEach(usableVeicleVO -> {
usableVeicleVO
.
setAllowRent
(
SYS_TRUE
);
// //判断是否预定时间内可租
//如果"必须在这时间后预定" 存在 并且 比预定开始时间 要晚,那么不允许预定
// usableVeicleVO.setAllowRent(SYS_TRUE);
if
(
null
!=
usableVeicleVO
.
getToLiftMustAfterDate
()
&&
DateUtil
.
date
(
shuntApply
.
getStartTime
()).
isBeforeOrEquals
(
usableVeicleVO
.
getToLiftMustAfterDate
()))
{
// //如果"必须在这时间后预定" 存在 并且 比预定开始时间 要晚,那么不允许预定
usableVeicleVO
.
setAllowRent
(
SYS_FALSE
);
// if(null != usableVeicleVO.getToLiftMustAfterDate() && DateUtil.date(shuntApply.getStartTime()).isBeforeOrEquals(usableVeicleVO.getToLiftMustAfterDate())) {
}
// usableVeicleVO.setAllowRent(SYS_FALSE);
// }
//如果"必须在这时间前预定" 存在 并且 比预定结束时间 要早,那么不允许预定
//
if
(
null
!=
usableVeicleVO
.
getToReturnMustBeforeDate
()
&&
DateUtil
.
date
(
shuntApply
.
getEndTime
()).
isAfterOrEquals
(
usableVeicleVO
.
getToReturnMustBeforeDate
()))
{
// //如果"必须在这时间前预定" 存在 并且 比预定结束时间 要早,那么不允许预定
usableVeicleVO
.
setAllowRent
(
SYS_FALSE
);
// if(null != usableVeicleVO.getToReturnMustBeforeDate() && DateUtil.date(shuntApply.getEndTime()).isAfterOrEquals(usableVeicleVO.getToReturnMustBeforeDate())) {
}
// usableVeicleVO.setAllowRent(SYS_FALSE);
if
(
SYS_TRUE
.
equals
(
usableVeicleVO
.
getAllowRent
()))
{
// }
vehicles
.
add
(
BeanUtil
.
toBean
(
usableVeicleVO
,
UsableVeicleVO
.
class
));
// if(SYS_TRUE.equals(usableVeicleVO.getAllowRent())) {
}
// vehicles.add(BeanUtil.toBean(usableVeicleVO, UsableVeicleVO.class));
});
// }
// });
if
(
CollUtil
.
isNotEmpty
(
vehicles
))
{
//
StewardShuntApply
stewardShuntApply
=
BeanUtil
.
toBean
(
shuntApply
,
StewardShuntApply
.
class
);
// if(CollUtil.isNotEmpty(vehicles)) {
stewardShuntApply
.
setVehicles
(
vehicles
);
// StewardShuntApply stewardShuntApply = BeanUtil.toBean(shuntApply, StewardShuntApply.class);
stewardShuntApply
.
setVehicleModel
(
vehicleFeign
.
get
(
modelId
).
getData
());
// stewardShuntApply.setVehicles(vehicles);
returnList
.
add
(
stewardShuntApply
);
// stewardShuntApply.setVehicleModel(vehicleFeign.get(modelId).getData());
}
// returnList.add(stewardShuntApply);
// }
});
//
}
// });
// }
}
//
// }
//
}
//
return
ObjectRestResponse
.
succ
(
returnList
);
// }
return
ObjectRestResponse
.
succ
(
list
);
}
}
@RequestMapping
(
value
=
"/steward/confirmApply"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/steward/confirmApply"
,
method
=
RequestMethod
.
POST
)
...
@@ -194,9 +197,46 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
...
@@ -194,9 +197,46 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
@ResponseBody
@ResponseBody
@ApiOperation
(
value
=
"申请的详情"
)
@ApiOperation
(
value
=
"申请的详情"
)
public
ObjectRestResponse
stewardApplyDetail
(
Integer
applyId
)
{
public
ObjectRestResponse
stewardApplyDetail
(
Integer
applyId
)
{
Integer
companyId
=
getAdminUserInfo
().
getCompanyId
();
ShuntApply
shuntApply
=
baseBiz
.
selectById
(
applyId
);
ShuntApply
shuntApply
=
baseBiz
.
selectById
(
applyId
);
S
huntApplyController
.
ShuntApplyVO
shuntApplyVO
=
BeanUtil
.
toBean
(
shuntApply
,
ShuntApplyController
.
ShuntApplyVO
.
class
);
S
tewardShuntApply
shuntApplyVO
=
BeanUtil
.
toBean
(
shuntApply
,
StewardShuntApply
.
class
);
shuntApplyVO
.
setVehicleModel
(
vehicleFeign
.
get
(
shuntApply
.
getModelId
()).
getData
());
shuntApplyVO
.
setVehicleModel
(
vehicleFeign
.
get
(
shuntApply
.
getModelId
()).
getData
());
RentVehicleBookDTO
rbd
=
new
RentVehicleBookDTO
();
rbd
.
setModelId
(
shuntApply
.
getModelId
());
rbd
.
setParkBranchCompanyId
(
companyId
);
rbd
.
setStartCompanyId
(
companyId
);
rbd
.
setEndCompanyId
(
companyId
);
rbd
.
setBookStartDate
(
DateUtil
.
date
(
shuntApply
.
getStartTime
()).
toDateStr
());
rbd
.
setBookEndDate
(
DateUtil
.
date
(
shuntApply
.
getEndTime
()).
toDateStr
());
rbd
.
setBookStartDateTime
(
DateUtil
.
date
(
shuntApply
.
getStartTime
()).
toTimeStr
());
rbd
.
setBookEndDateTime
(
DateUtil
.
date
(
shuntApply
.
getEndTime
()).
toTimeStr
());
//查询本公司时间段内可用车辆
ObjectRestResponse
<
PageDataVO
<
UsableVeicleVO
>>
usableVehiclePage
=
vehicleFeign
.
applyUsableVehicle
(
rbd
);
if
(
CollUtil
.
isNotEmpty
(
usableVehiclePage
.
getData
().
getData
()))
{
List
<
UsableVeicleVO
>
vehicles
=
CollUtil
.
newArrayList
();
usableVehiclePage
.
getData
().
getData
().
forEach
(
usableVeicleVO
->
{
//判断是否预定时间内可租
usableVeicleVO
.
setAllowRent
(
SYS_TRUE
);
//如果"必须在这时间后预定" 存在 并且 比预定开始时间 要晚,那么不允许预定
if
(
null
!=
usableVeicleVO
.
getToLiftMustAfterDate
()
&&
DateUtil
.
date
(
shuntApply
.
getStartTime
()).
isBeforeOrEquals
(
usableVeicleVO
.
getToLiftMustAfterDate
()))
{
usableVeicleVO
.
setAllowRent
(
SYS_FALSE
);
}
//如果"必须在这时间前预定" 存在 并且 比预定结束时间 要早,那么不允许预定
if
(
null
!=
usableVeicleVO
.
getToReturnMustBeforeDate
()
&&
DateUtil
.
date
(
shuntApply
.
getEndTime
()).
isAfterOrEquals
(
usableVeicleVO
.
getToReturnMustBeforeDate
()))
{
usableVeicleVO
.
setAllowRent
(
SYS_FALSE
);
}
if
(
SYS_TRUE
.
equals
(
usableVeicleVO
.
getAllowRent
()))
{
vehicles
.
add
(
BeanUtil
.
toBean
(
usableVeicleVO
,
UsableVeicleVO
.
class
));
}
});
if
(
CollUtil
.
isNotEmpty
(
vehicles
))
{
shuntApplyVO
.
setVehicles
(
vehicles
);
}
}
return
ObjectRestResponse
.
succ
(
shuntApplyVO
);
return
ObjectRestResponse
.
succ
(
shuntApplyVO
);
}
}
...
@@ -229,7 +269,7 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
...
@@ -229,7 +269,7 @@ public class BgShuntApplyController extends BaseController<ShuntApplyBiz, ShuntA
}
}
@Data
@Data
public
static
class
ListDTO
{
public
static
class
ListDTO
extends
PageParam
{
Integer
cityCode
;
Integer
cityCode
;
}
}
...
...
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