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
afb68825
Commit
afb68825
authored
Oct 18, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/holiday-price' into holiday-price
parents
5d37e499
c614865b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
17 deletions
+49
-17
VehicleModelCalendarPriceDTO.java
...atform/vehicle/pojo/dto/VehicleModelCalendarPriceDTO.java
+1
-0
VehicleModelCalendarPriceSaveDTO.java
...rm/vehicle/pojo/dto/VehicleModelCalendarPriceSaveDTO.java
+4
-0
VehicleModelHolidayPriceSaveDTO.java
...orm/vehicle/pojo/dto/VehicleModelHolidayPriceSaveDTO.java
+2
-2
VehicleModelDayPriceVo.java
...xxfc/platform/vehicle/pojo/vo/VehicleModelDayPriceVo.java
+4
-0
VehicleModelCalendarPriceBiz.java
...fc/platform/vehicle/biz/VehicleModelCalendarPriceBiz.java
+18
-2
VehicleModelHolidayPriceBiz.java
...xfc/platform/vehicle/biz/VehicleModelHolidayPriceBiz.java
+12
-9
VehicleModelCalendarPriceAdminController.java
.../rest/admin/VehicleModelCalendarPriceAdminController.java
+8
-4
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/VehicleModelCalendarPriceDTO.java
View file @
afb68825
...
...
@@ -24,6 +24,7 @@ public class VehicleModelCalendarPriceDTO implements Serializable {
private
Date
date
;
private
BigDecimal
price
;
private
BigDecimal
no_discount_price
;
private
Integer
freeDays
;
private
Boolean
isSelect
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/VehicleModelCalendarPriceSaveDTO.java
View file @
afb68825
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
dto
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -25,7 +26,10 @@ public class VehicleModelCalendarPriceSaveDTO implements Serializable {
/**
* 日期设置
*/
@JSONField
(
serialize
=
false
)
private
Date
vehicleModelDay
;
private
String
date
;
/**
* 是否全局设置
*/
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/VehicleModelHolidayPriceSaveDTO.java
View file @
afb68825
...
...
@@ -6,7 +6,7 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.
Date
;
import
java.util.
List
;
/**
* @author libin
...
...
@@ -24,7 +24,7 @@ public class VehicleModelHolidayPriceSaveDTO implements Serializable {
/**
* 节假日日期
*/
private
Date
festivalDay
;
private
String
date
;
/**
* 节假日
*/
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/vo/VehicleModelDayPriceVo.java
View file @
afb68825
...
...
@@ -29,4 +29,8 @@ public class VehicleModelDayPriceVo extends VehicleModelDTO implements Serializa
* 倍数
*/
private
Double
multiple
;
/**
* 会员等级
*/
private
Integer
level
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleModelCalendarPriceBiz.java
View file @
afb68825
...
...
@@ -80,9 +80,14 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
List
<
Date
>
dateList
=
vehicleModelCalendarPrices
.
stream
().
peek
(
x
->
{
VehicleModelCalendarPrice
calendarPrice
=
new
VehicleModelCalendarPrice
();
BeanUtils
.
copyProperties
(
x
,
calendarPrice
);
Date
date
=
Date
.
from
(
LocalDate
.
parse
(
x
.
getDate
()).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
calendarPrice
.
setVehicleModelDay
(
date
);
calendarPrice
.
setCrtTime
(
new
Date
());
calendarPrice
.
setCrtUserId
(
userId
);
calendarPrice
.
setIsDel
(
0
);
x
.
setVehicleModelDay
(
date
);
vehicleModelCalendarPriceList
.
add
(
calendarPrice
);
}).
map
(
VehicleModelCalendarPriceSaveDTO:
:
getVehicleModelDay
).
distinct
().
collect
(
Collectors
.
toList
());
//1.删除当月做更改了的日期的数据
...
...
@@ -93,7 +98,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
Example
example
=
new
Example
(
VehicleModelCalendarPrice
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIn
(
"vehicleModelDay"
,
dateList
);
mapper
.
updateByExample
(
vehicleModelCalendarPrice
,
example
);
mapper
.
updateByExample
Selective
(
vehicleModelCalendarPrice
,
example
);
//2.插入新的数据
mapper
.
insertList
(
vehicleModelCalendarPriceList
);
}
...
...
@@ -144,6 +149,8 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
vehicleModelDayPriceVo
.
setMultiple
(
multiple
);
BigDecimal
aPrice
=
isNullOfVehicleModelPrice
?
null
:
vehicleModelCalendarPriceMap
.
get
(
vehicleModelDTO
.
getVehicleModelId
()).
getPrice
();
vehicleModelDayPriceVo
.
setPrice
(
aPrice
);
Integer
level
=
isNullOfVehicleModelPrice
?
null
:
vehicleModelCalendarPriceMap
.
get
(
vehicleModelDTO
.
getVehicleModelId
()).
getLevel
();
vehicleModelDayPriceVo
.
setLevel
(
level
);
vehicleModelDayPriceVos
.
add
(
vehicleModelDayPriceVo
);
}
return
vehicleModelDayPriceVos
;
...
...
@@ -174,8 +181,13 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
for
(
VehicleModelCalendarPrice
calendarPrice
:
vehicleModelCalendarPriceList
)
{
vehicleModelCalendarPrice
=
new
VehicleModelCalendarPriceSaveDTO
();
BeanUtils
.
copyProperties
(
calendarPrice
,
vehicleModelCalendarPrice
);
vehicleModelCalendarPrice
.
setVehicleModelId
(
null
);
vehicleModelCalendarPriceSaveDTOS
.
add
(
vehicleModelCalendarPrice
);
}
Map
<
Date
,
Optional
<
VehicleModelCalendarPriceSaveDTO
>>
result
=
vehicleModelCalendarPriceSaveDTOS
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
VehicleModelCalendarPriceSaveDTO:
:
getVehicleModelDay
,
Collectors
.
maxBy
(
Comparator
.
comparing
(
VehicleModelCalendarPriceSaveDTO:
:
getId
))));
vehicleModelCalendarPriceSaveDTOS
=
result
.
values
().
stream
().
map
(
x
->
x
.
orElseGet
(
null
)).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
return
vehicleModelCalendarPriceSaveDTOS
;
}
...
...
@@ -257,6 +269,8 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
vehicleModelCalendarPriceDTO
=
new
VehicleModelCalendarPriceDTO
();
//价格重置
vehicle_price
=
vehicle_base_price
;
//未乘以会员折扣的价格
BigDecimal
no_discount_price
=
new
BigDecimal
(
vehicle_price
.
doubleValue
());
//免费天数重置
Integer
free_days
=
DEFAULT_FREE_DAYS
;
//节假日对应的价格和免费天数
...
...
@@ -270,7 +284,8 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
}
else
{
switch
(
vehicleModelCalendarPrice
.
getType
())
{
case
VehicleModelPriceType
.
MULTIPLE
:
vehicle_price
=
vehicle_price
.
multiply
(
new
BigDecimal
(
vehicleModelCalendarPrice
.
getMultiple
().
doubleValue
()
*
(
discount
/
100.00
)));
no_discount_price
=
vehicle_price
.
multiply
(
new
BigDecimal
(
vehicleModelCalendarPrice
.
getMultiple
().
doubleValue
()));
vehicle_price
=
no_discount_price
.
multiply
(
new
BigDecimal
(
discount
/
100.0
));
break
;
case
VehicleModelPriceType
.
ABS
:
vehicle_price
=
vehicleModelCalendarPrice
.
getPrice
().
multiply
(
new
BigDecimal
(
discount
/
100.00
));
...
...
@@ -292,6 +307,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
vehicle_price
=
(
BigDecimal
)
price_freeDays_map
.
get
(
PRICE_VAL
);
free_days
=
(
Integer
)
price_freeDays_map
.
get
(
DAYS_VAL
);
}
vehicleModelCalendarPriceDTO
.
setNo_discount_price
(
no_discount_price
);
vehicleModelCalendarPriceDTO
.
setPrice
(
vehicle_price
.
setScale
(
2
,
RoundingMode
.
DOWN
));
vehicleModelCalendarPriceDTO
.
setFreeDays
(
free_days
);
final_startLocalDate
=
final_startLocalDate
.
plusDays
(
1
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleModelHolidayPriceBiz.java
View file @
afb68825
...
...
@@ -34,6 +34,8 @@ import java.util.Objects;
@Service
public
class
VehicleModelHolidayPriceBiz
extends
BaseBiz
<
VehicleModelHolidayPriceMapper
,
VehicleModelHolidayPrice
>
{
/**
* 保存
*
...
...
@@ -43,6 +45,7 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric
public
void
addVehicleModelHolidayPrice
(
VehicleModelHolidayPriceSaveDTO
vehicleModelHolidayPriceSaveDTO
,
Integer
userId
)
{
VehicleModelHolidayPrice
vehicleModelHolidayPrice
=
new
VehicleModelHolidayPrice
();
BeanUtils
.
copyProperties
(
vehicleModelHolidayPriceSaveDTO
,
vehicleModelHolidayPrice
);
vehicleModelHolidayPrice
.
setFestivalDay
(
Date
.
from
(
LocalDate
.
parse
(
vehicleModelHolidayPriceSaveDTO
.
getDate
()).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()));
//编辑
if
(
Objects
.
nonNull
(
vehicleModelHolidayPriceSaveDTO
.
getId
()))
{
vehicleModelHolidayPrice
.
setUpdTime
(
new
Date
());
...
...
@@ -62,20 +65,19 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric
}
/**
*
* @param multiple 倍数
* @param freeDays 免费天数
* @param configDate 设置的日期*月份
*/
public
void
updateVehicleModelHolidayPrice
(
Double
multiple
,
Integer
freeDays
,
Date
configDate
)
{
public
void
updateVehicleModelHolidayPrice
(
Double
multiple
,
Integer
freeDays
,
Date
configDate
)
{
VehicleModelHolidayPrice
vehicleModelHolidayPrice
=
new
VehicleModelHolidayPrice
();
vehicleModelHolidayPrice
.
setMultiple
(
multiple
);
vehicleModelHolidayPrice
.
setFreeDays
(
freeDays
);
Example
example
=
new
Example
(
VehicleModelHolidayPrice
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
setCondtionDate
(
configDate
,
criteria
);
int
effect
=
mapper
.
updateByExampleSelective
(
vehicleModelHolidayPrice
,
example
);
if
(
effect
<
1
)
{
setCondtionDate
(
configDate
,
criteria
);
int
effect
=
mapper
.
updateByExampleSelective
(
vehicleModelHolidayPrice
,
example
);
if
(
effect
<
1
)
{
throw
new
BaseException
(
"车型节假日更新失败"
);
}
}
...
...
@@ -90,7 +92,7 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric
List
<
VehicleModelHolidayPriceVo
>
vehicleModelHolidayPriceVos
=
new
ArrayList
<>();
Example
example
=
new
Example
(
VehicleModelHolidayPrice
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
setCondtionDate
(
vehicleModelHolidayPriceFindDTO
.
getDate
(),
criteria
);
setCondtionDate
(
vehicleModelHolidayPriceFindDTO
.
getDate
(),
criteria
);
if
(
StringUtils
.
isNotEmpty
(
vehicleModelHolidayPriceFindDTO
.
getFestival
())
&&
vehicleModelHolidayPriceFindDTO
.
getFestival
().
trim
().
length
()
>
0
)
{
criteria
.
andLike
(
"festival"
,
String
.
format
(
"%%%s%%"
,
vehicleModelHolidayPriceFindDTO
.
getFestival
()));
}
...
...
@@ -148,10 +150,11 @@ public class VehicleModelHolidayPriceBiz extends BaseBiz<VehicleModelHolidayPric
/**
* 设置查询条件日期
*
* @param conditionDate
* @param criteria
*/
private
void
setCondtionDate
(
Date
conditionDate
,
Example
.
Criteria
criteria
){
private
void
setCondtionDate
(
Date
conditionDate
,
Example
.
Criteria
criteria
)
{
LocalDate
localDate
=
LocalDate
.
from
(
conditionDate
.
toInstant
());
//开始日期
Instant
startInstant
=
localDate
.
withDayOfMonth
(
1
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
();
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/VehicleModelCalendarPriceAdminController.java
View file @
afb68825
...
...
@@ -11,6 +11,8 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -34,16 +36,18 @@ public class VehicleModelCalendarPriceAdminController {
return
ObjectRestResponse
.
succ
();
}
@ApiOperation
(
"车型日历
月份
价格"
)
@ApiOperation
(
"车型日历价格"
)
@GetMapping
(
"/day"
)
public
ObjectRestResponse
<
VehicleModelDayPriceVo
>
listVehicleModelCalendarPriceWithMonth
(
@RequestParam
(
value
=
"date"
)
Date
date
){
public
ObjectRestResponse
<
VehicleModelDayPriceVo
>
listVehicleModelCalendarPriceWithMonth
(
@RequestParam
(
value
=
"date"
)
String
dateStr
){
Date
date
=
Date
.
from
(
LocalDate
.
parse
(
dateStr
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
List
<
VehicleModelDayPriceVo
>
vehicleModelDayPriceVos
=
vehicleModelCalendarPriceBiz
.
findVehicleModelcalendarPriceByDateWithDay
(
date
);
return
ObjectRestResponse
.
succ
(
vehicleModelDayPriceVos
);
}
@ApiOperation
(
"根据
日查询不同车型
的设置"
)
@ApiOperation
(
"根据
月份查询
的设置"
)
@GetMapping
(
"/month"
)
public
ObjectRestResponse
<
List
<
VehicleModelCalendarPriceSaveDTO
>>
listVehicleModelCalendarPriceWithDay
(
@RequestParam
(
value
=
"date"
)
Date
date
){
public
ObjectRestResponse
<
List
<
VehicleModelCalendarPriceSaveDTO
>>
listVehicleModelCalendarPriceWithDay
(
@RequestParam
(
value
=
"date"
)
String
dateStr
){
Date
date
=
Date
.
from
(
LocalDate
.
parse
(
dateStr
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
List
<
VehicleModelCalendarPriceSaveDTO
>
calendarPrices
=
vehicleModelCalendarPriceBiz
.
findVehicleModelCalendarPricesByDateWithMonth
(
date
);
return
ObjectRestResponse
.
succ
(
calendarPrices
);
}
...
...
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