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
b9d55308
Commit
b9d55308
authored
Nov 28, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
3d543d0e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
177 additions
and
1 deletion
+177
-1
VehicleFindDTO.java
...va/com/xxfc/platform/vehicle/pojo/dto/VehicleFindDTO.java
+57
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+43
-0
VehicleMapper.java
.../java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
+2
-0
AppVehicleController.java
.../com/xxfc/platform/vehicle/rest/AppVehicleController.java
+13
-0
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+61
-0
VehiclePublishMapper.xml
...server/src/main/resources/mapper/VehiclePublishMapper.xml
+1
-1
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/VehicleFindDTO.java
View file @
b9d55308
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
dto
;
import
com.github.wxiaoqi.security.common.constant.CommonConstants
;
import
com.github.wxiaoqi.security.common.vo.DataInter
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
YMR_SLASH_FORMATTER
;
/**
* @author libin
* @version 1.0
...
...
@@ -17,6 +25,8 @@ import java.util.List;
@Data
public
class
VehicleFindDTO
extends
PageParam
implements
DataInter
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
@ApiModelProperty
(
"商品Id"
)
private
String
vehicleId
;
...
...
@@ -59,4 +69,51 @@ public class VehicleFindDTO extends PageParam implements DataInter {
@ApiModelProperty
(
"店铺状态:1-上架中;2-下架中;3-已调出"
)
private
Integer
goodStatus
;
/**
* 预定目标日期(开始)
*/
@ApiModelProperty
(
"目标日期(开始)"
)
private
String
bookStartDate
;
/**
* 预定目标日期(结束)
*/
@ApiModelProperty
(
"目标日期(结束)"
)
private
String
bookEndDate
;
/**
* 预定目标日期(开始)
*/
@ApiModelProperty
(
"目标时间(开始)"
)
private
String
bookStartDateTime
;
/**
* 预定目标日期(结束)
*/
@ApiModelProperty
(
"目标时间(结束)"
)
private
String
bookEndDateTime
;
@ApiModelProperty
(
"开始时间戳"
)
Long
startDateTamp
;
@ApiModelProperty
(
"结束时间戳"
)
Long
endDateTamp
;
public
void
setStartDateTamp
(
Long
startDateTamp
)
{
this
.
startDateTamp
=
startDateTamp
;
this
.
bookStartDate
=
DEFAULT_DATE_TIME_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
startDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
this
.
bookStartDateTime
=
CommonConstants
.
DATE_TIME_LINE_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
startDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
}
public
void
setEndDateTamp
(
Long
endDateTamp
)
{
this
.
endDateTamp
=
endDateTamp
;
this
.
bookEndDate
=
DEFAULT_DATE_TIME_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
endDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
this
.
bookEndDateTime
=
CommonConstants
.
DATE_TIME_LINE_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
endDateTamp
),
ZoneOffset
.
ofHours
(
8
)));
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
b9d55308
...
...
@@ -1671,6 +1671,23 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
mapper
.
selectList
(
vehicleFindDTO
);
}
public
List
<
VehicleVO
>
getListV2
(
VehicleFindDTO
vehicleFindDTO
){
Map
<
String
,
Object
>
map
=
setBookDate
(
vehicleFindDTO
);
return
mapper
.
selectListV2
(
map
);
}
public
ObjectRestResponse
selectListV2
(
VehicleFindDTO
vehicleFindDTO
){
PageDataVO
<
VehicleVO
>
dataVo
=
PageDataVO
.
pageInfo
(
vehicleFindDTO
.
initQuery
(),()->
getListV2
(
vehicleFindDTO
));
List
<
VehicleVO
>
list
=
dataVo
.
getData
();
if
(
list
!=
null
&&
list
.
size
()
>
0
){
for
(
VehicleVO
vehicleVO
:
list
){
vehicleVO
.
setExtensionVOS
(
extensionBiz
.
getTree
(
vehicleVO
.
getId
()));
}
}
return
ObjectRestResponse
.
succ
(
dataVo
);
}
public
ObjectRestResponse
selectList
(
VehicleFindDTO
vehicleFindDTO
){
Integer
type
=
vehicleFindDTO
.
getType
()
==
null
?
0
:
vehicleFindDTO
.
getType
();
if
(
type
>
0
){
...
...
@@ -1814,6 +1831,32 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
ObjectRestResponse
.
succ
();
}
public
Map
<
String
,
Object
>
setBookDate
(
VehicleFindDTO
dto
){
List
<
String
>
notBookedDates
=
Lists
.
newArrayList
();
if
(
StringUtils
.
isNotBlank
(
dto
.
getBookEndDate
())
&&
StringUtils
.
isNotBlank
(
dto
.
getBookEndDate
()))
{
notBookedDates
=
convertDatePeriod2List
(
dto
.
getBookStartDate
(),
dto
.
getBookEndDate
());
}
Map
<
String
,
Object
>
params
=
BeanUtil
.
beanToMap
(
dto
);
//若传入预定信息查询条件,则查询对应月份预定信息查询条件(不超过3个月)
if
(
CollectionUtils
.
isEmpty
(
notBookedDates
))
{
//return;
}
//筛选出查询条件所在月份
Set
<
String
>
allYearMonth
=
new
HashSet
<>();
//记录所有年月
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
new
HashMap
<>();
//预定年月 - 预定日期列表
Map
<
String
,
List
<
String
>>
yearMonthAndDateNotBooked
=
new
HashMap
<>();
//未预定年月 - 未预定日期列表
classifyByYearMonth
(
notBookedDates
,
yearMonthAndDateNotBooked
,
allYearMonth
);
if
(
allYearMonth
.
size
()
>
MAX_MONTH_COUNT_BOOKED_INFO_QUERY
)
{
throw
new
BaseException
(
" only 3 month can be included <bookedInfo> param."
);
}
//加入预定信息查询条件
fillBookedDateSearchParam
(
params
,
yearMonthAndDate
,
yearMonthAndDateNotBooked
);
return
params
;
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
View file @
b9d55308
...
...
@@ -65,6 +65,8 @@ public interface VehicleMapper extends Mapper<Vehicle> {
List
<
VehicleVO
>
selectList
(
VehicleFindDTO
vehicleFindDTO
);
List
<
VehicleVO
>
selectListV2
(
Map
<
String
,
Object
>
param
);
@Select
(
"SELECT COUNT(*) FROM vehicle WHERE is_del=0 and subordinate_branch = #{commpanyId}"
)
Long
countByCompamyId
(
@Param
(
"commpanyId"
)
Integer
commpanyId
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/AppVehicleController.java
View file @
b9d55308
...
...
@@ -41,6 +41,19 @@ public class AppVehicleController extends BaseController<VehicleBiz> {
}
@GetMapping
(
"selectListV2"
)
@ApiModelProperty
(
"商品列表"
)
public
ObjectRestResponse
selectListV2
(
VehicleFindDTO
vehicleFindDTO
)
{
if
(
vehicleFindDTO
.
getBranchId
()
==
null
||
vehicleFindDTO
.
getBranchId
()
==
0
){
List
<
Integer
>
companyIds
=
getBusinessUserCompanyIds
();
if
(
companyIds
!=
null
&&
companyIds
.
size
()
>
0
){
vehicleFindDTO
.
setBranchId
(
companyIds
.
get
(
0
));
}
}
return
baseBiz
.
selectListV2
(
vehicleFindDTO
);
}
@PostMapping
(
"updVehicle"
)
@ApiModelProperty
(
"更新商品信息"
)
public
ObjectRestResponse
updVehicle
(
@RequestBody
Vehicle
vehicle
)
{
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
b9d55308
...
...
@@ -1455,6 +1455,67 @@
</select>
<select
id=
"selectListV2"
resultType=
"com.xxfc.platform.vehicle.pojo.vo.VehicleVO"
parameterType=
"java.util.Map"
>
SELECT
v.*,
b.cn_name as brandName,
c.`name` categoryName
FROM (
<include
refid=
"searchUsableSqlV2"
/>
) v
LEFT JOIN (select * from vehicle_use_time where status =1 ) u ON v.id = u.vehicle_id
LEFT JOIN vehicle_brand b ON v.brand_id=b.id
LEFT JOIN vehicle_category c ON v.category_id=c.id
<where>
v.is_del = 0 and u.id is null
<if
test=
"goodsType != null "
>
AND v.`goods_type`= #{goodsType}
</if>
<if
test=
"branchId != null and branchId > 0"
>
AND (v.`subordinate_branch`= #{branchId} AND v.`manage_company_id`= #{branchId} )
</if>
</where>
ORDER BY v.create_time DESC
</select>
<sql
id=
"searchUsableSqlV2"
>
select * from vehicle v
<if
test=
" yearMonthAndParam !=null "
>
left join (
select
vbi.vehicle,
BIT_OR(
CONCAT(
<foreach
collection=
"yearMonthAndParam"
index=
"yearMonth"
item=
"andOperation"
separator=
","
>
<include
refid=
"yearMonthAndParamSql"
></include>
</foreach>
)
) as bit_str
from vehicle_book_info vbi group by vbi.vehicle
) vbi on v.`id` = vbi.vehicle
</if>
<!-- <if test="startCompanyId != null and endCompanyId != null ">-->
<!--
* 原(大于预约结束时间,小于预约开始时间的预约记录)
* 相交叉(大于预约开始时间,小于预约结束时间的预约记录)
-->
<where>
v.is_del = 0
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if
test=
" yearMonthAndParam !=null and yearMonthAndParam != null and (yearNo4Where == null or yearNo4Where != true)"
>
and vbi.bit_str = #{yearMonthAndParamBitStr}
</if>
<if
test=
" yearNo4Where != null and recordIntersection != null and recordIntersection == true"
>
<!-- 1、最后还车时间(天) 大于 最早提车时间(天) 并且多于一天-->
and if((abr.to_lift_must_after_date is null or abr.to_return_must_before_date is null), true
, (str_to_date(DATE_FORMAT(abr.to_return_must_before_date,'%Y-%m-%d'),'%Y-%m-%d %H:%i:%s')
> DATE_ADD(DATE_ADD(str_to_date(DATE_FORMAT(abr.to_lift_must_after_date,'%Y-%m-%d'),'%Y-%m-%d %H:%i:%s'),INTERVAL 2 DAY),INTERVAL -1 SECOND))
)
</if>
</where>
</sql>
<select
id=
"appSelectList"
resultType=
"com.xxfc.platform.vehicle.pojo.vo.VehicleVO"
parameterType=
"com.xxfc.platform.vehicle.pojo.dto.VehicleFindAppDTO"
>
SELECT
v.*,
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehiclePublishMapper.xml
View file @
b9d55308
...
...
@@ -21,7 +21,7 @@
AND p.`goods_type`= #{goodsType}
</if>
<if
test=
"nowTime != null and nowTime > 0"
>
AND p.`publish_end_time` >= #{nowTime}
AND p.`publish_end_time` >= #{nowTime}
AND p.number > (p.confirm_number+p.wait_confirm_number)
</if>
<if
test=
"dataCompanyIds != null and dataCompanyIds.size > 0"
>
and p.id 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