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
2e958b5d
Commit
2e958b5d
authored
Aug 26, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into hz_dev
parents
575e4c22
efaca558
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
198 additions
and
54 deletions
+198
-54
Article.java
.../src/main/java/com/xxfc/platform/uccn/entity/Article.java
+8
-3
UccnApplication.java
...src/main/java/com/xxfc/platform/uccn/UccnApplication.java
+2
-2
ArticleBiz.java
.../src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
+87
-4
ArticleMapper.java
...ain/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
+7
-1
ArticleController.java
...n/java/com/xxfc/platform/uccn/rest/ArticleController.java
+30
-9
ArticleMapper.xml
...x-uccn-server/src/main/resources/mapper/ArticleMapper.xml
+2
-1
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+40
-23
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+10
-10
VehicleBookInfoBiz.java
...ava/com/xxfc/platform/vehicle/biz/VehicleBookInfoBiz.java
+4
-0
VehicleBookInfoMapper.java
...m/xxfc/platform/vehicle/mapper/VehicleBookInfoMapper.java
+2
-0
VehicleBookInfoMapper.xml
...erver/src/main/resources/mapper/VehicleBookInfoMapper.xml
+6
-1
No files found.
xx-uccn/xx-uccn-api/src/main/java/com/xxfc/platform/uccn/entity/Article.java
View file @
2e958b5d
...
...
@@ -68,21 +68,21 @@ public class Article {
*/
@Column
(
name
=
"author"
)
@ApiModelProperty
(
value
=
"作者"
)
private
Integer
author
;
private
String
author
;
/**
* 发布人
*/
@Column
(
name
=
"publisher"
)
@ApiModelProperty
(
value
=
"发布人"
)
private
Integer
publisher
;
private
String
publisher
;
/**
* 封面图
*/
@Column
(
name
=
"cover_image"
)
@ApiModelProperty
(
value
=
"封面图"
)
private
Integer
coverImage
;
private
String
coverImage
;
/**
* 权重
...
...
@@ -105,6 +105,11 @@ public class Article {
@ApiModelProperty
(
value
=
"是否上下架:0-否,1-是"
)
private
Integer
status
;
@Column
(
name
=
"type"
)
@ApiModelProperty
(
value
=
"文章发布网站:0-所有,1-新欣房车官网,2-滴房车官网"
)
private
Integer
type
;
/**
* 创建时间
*/
...
...
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/UccnApplication.java
View file @
2e958b5d
...
...
@@ -12,8 +12,8 @@ import tk.mybatis.spring.annotation.MapperScan;
* @author Administrator
*/
@SpringBootApplication
(
scanBasePackages
={
"com.xxfc.platform.uccn
"
,
"com.
github.wxiaoqi
"
"com.github.wxiaoqi
"
,
"com.
xxfc.platform
"
})
@EnableDiscoveryClient
@EnableAceAuthClient
...
...
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
View file @
2e958b5d
...
...
@@ -7,18 +7,101 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import
com.xxfc.platform.uccn.entity.Article
;
import
com.xxfc.platform.uccn.mapper.ArticleMapper
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
java.util.*
;
import
java.util.List
;
/**
* @author Administrator
*/
@Service
public
class
ArticleBiz
extends
BaseBiz
<
ArticleMapper
,
Article
>
{
/**
* 随机文章条数
*/
private
final
Integer
RANDOM_NUMBER
=
3
;
/**
* 首页文章条数
*/
private
final
Integer
HOME_PAGE_NUMBER
=
4
;
public
PageInfo
getArticleList
(
Integer
page
,
Integer
limit
)
{
PageHelper
.
startPage
(
page
,
limit
);
List
articleList
=
mapper
.
getArticleList
();
/**
* 文章列表
* @param page
* @param limit
* @param type
* @return
*/
public
PageInfo
getArticleList
(
Integer
page
,
Integer
limit
,
Integer
type
)
{
PageHelper
.
startPage
(
page
,
limit
);
List
articleList
=
mapper
.
getArticleList
(
type
);
return
PageInfo
.
of
(
articleList
);
}
/**
* 获取一条数据
* @param id
* @return
*/
public
Article
getOne
(
Integer
id
)
{
Example
example
=
Example
.
builder
(
Article
.
class
).
where
(
WeekendSqls
.<
Article
>
custom
()
.
andEqualTo
(
Article:
:
getId
,
id
)
.
andEqualTo
(
Article:
:
getIsDel
,
0
)
.
andEqualTo
(
Article:
:
getStatus
,
1
)
).
build
();
Article
article
=
mapper
.
selectOneByExample
(
example
);
return
article
;
}
/**
* 随机获取三条连续的文章
* @param type
* @return
*/
public
List
getThree
(
Integer
type
)
{
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
);
if
(!
Objects
.
isNull
(
articleList
))
{
int
size
=
articleList
.
size
();
if
(
RANDOM_NUMBER
>=
size
)
{
return
articleList
;
}
else
{
Random
random
=
new
Random
();
int
r
=
random
.
nextInt
(
size
-
RANDOM_NUMBER
+
1
);
List
<
Article
>
result
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
RANDOM_NUMBER
.
intValue
();
i
++){
int
index
=
i
+
r
;
result
.
add
(
articleList
.
get
(
index
));
}
return
result
;
}
}
return
new
ArrayList
();
}
/**
* 首页文章列表
* @param type
* @return
*/
public
List
getHomePageArticle
(
Integer
type
){
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
);
if
(
Objects
.
isNull
(
articleList
))
{
return
new
ArrayList
();
}
else
{
if
(
articleList
.
size
()>
HOME_PAGE_NUMBER
)
{
return
articleList
.
subList
(
0
,
HOME_PAGE_NUMBER
);
}
else
{
return
articleList
;
}
}
}
}
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
View file @
2e958b5d
package
com
.
xxfc
.
platform
.
uccn
.
mapper
;
import
com.xxfc.platform.uccn.entity.Article
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
...
...
@@ -9,5 +10,10 @@ import java.util.List;
* @author Administrator
*/
public
interface
ArticleMapper
extends
Mapper
<
Article
>
{
List
getArticleList
();
/**
* 根据网站类型查询文章
* @param type
* @return
*/
List
<
Article
>
getArticleList
(
@Param
(
"type"
)
Integer
type
);
}
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/rest/ArticleController.java
View file @
2e958b5d
...
...
@@ -5,14 +5,15 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import
com.xxfc.platform.uccn.biz.ArticleBiz
;
import
com.xxfc.platform.uccn.entity.Article
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
/**
* 文章
*
* @author Administrator
*/
@RestController
...
...
@@ -22,9 +23,29 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
@GetMapping
(
"/list"
)
@ApiOperation
(
value
=
"获取文章列表"
)
public
ObjectRestResponse
getArticleList
(
@RequestParam
(
name
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
name
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
getArticleList
(
page
,
limit
));
}
public
ObjectRestResponse
getArticleList
(
@RequestParam
(
name
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
name
=
"limit"
,
defaultValue
=
"10"
)
Integer
limit
,
@RequestParam
(
name
=
"type"
,
defaultValue
=
"0"
)
Integer
type
)
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
getArticleList
(
page
,
limit
,
type
));
}
@GetMapping
(
"/one/{id}"
)
@ApiOperation
(
value
=
"获取一条数据"
)
public
ObjectRestResponse
getOne
(
@PathVariable
Integer
id
)
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
getOne
(
id
));
}
@GetMapping
(
"/three/{type}"
)
@ApiOperation
(
value
=
"随机获取三条数据"
)
public
ObjectRestResponse
randomAccessToThreeData
(
@PathVariable
Integer
type
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
getThree
(
type
));
}
@GetMapping
(
"/homePage/{type}"
)
@ApiOperation
(
value
=
"获取首页文章列表"
)
public
ObjectRestResponse
getHomePageArticle
(
@PathVariable
Integer
type
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
getHomePageArticle
(
type
));
}
}
xx-uccn/xx-uccn-server/src/main/resources/mapper/ArticleMapper.xml
View file @
2e958b5d
...
...
@@ -4,7 +4,8 @@
<mapper
namespace=
"com.xxfc.platform.uccn.mapper.ArticleMapper"
>
<select
id=
"getArticleList"
resultType=
"com.xxfc.platform.uccn.entity.Article"
>
select title,epitome,add_time,cover_image from article where is_del=0 and status=1 order by weight,add_time DESC
select title,epitome,add_time,cover_image from article
where is_del=0 and status=1 and (type=#{type} or type=0) order by weight DESC,add_time DESC
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
2e958b5d
...
...
@@ -89,6 +89,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
private
VehicleBookHourInfoBiz
vehicleBookHourInfoBiz
;
@Autowired
UserFeign
userFeign
;
@Autowired
private
VehicleBookInfoBiz
vehicleBookInfoBiz
;
@Override
public
UserFeign
getUserFeign
()
{
...
...
@@ -429,10 +432,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
fillDateList4DatePeriod
(
yearMonthAndDate
,
DateTime
.
parse
(
startDay
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
),
DateTime
.
parse
(
endDay
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
)
);
if
(
yearMonthAndDate
.
size
()>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_BOOK_TWO_MONTH
);
}
...
...
@@ -469,8 +472,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
bookVehicleVo
.
setUnbookEndDate
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()).
toString
(
DATE_TIME_FORMATTER
));
unbookVehicle
(
bookVehicleVo
);
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
(
),
bookVehicleVo
.
getNotCheckTimeLegal
());
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
yearMonthAndDate
.
entrySet
())
{
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
startDay
.
toString
(
DATE_TIME_FORMATTER
),
endDay
.
toString
(
DATE_TIME_FORMATTER
),
bookVehicleVo
.
getNotCheckTimeLegal
());
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
yearMonthAndDate
.
entrySet
())
{
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
(),
map
);
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
VEHICLE_IS_BOOKED
);
...
...
@@ -529,7 +532,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
Integer
andOperationFactor
=
andOpratorParam
.
get
(
"andOperationFactor"
);
Integer
andOperationRs
=
andOpratorParam
.
get
(
"andOperationRs"
);
if
(
vehicleBookInfo
!=
null
&&
vehicleBookInfo
.
getBookedDate
()
!=
null
&&
((
vehicleBookInfo
.
getBookedDate
()
&
andOperationFactor
)
!=
andOperationRs
)){
//已经被预定
((
vehicleBookInfo
.
getBookedDate
()
&
andOperationFactor
)
!=
0
)){
//已经被预定
//当天已经被预定检查小时是否也被预定
return
filterHourInfoBooked
(
vehicleId
,
hourInfo
);
}
...
...
@@ -835,7 +838,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @param endDay
*/
private
void
fillDateList4DatePeriod
(
Map
<
String
,
List
<
String
>>
yearMonthAndDate
,
DateTime
startDay
,
DateTime
endDay
){
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)<=
0
;
curDate
=
curDate
.
plusDays
(
1
)){
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
(
ResultCode
.
ONLY_BOOK_FROM_TODAY
);
...
...
@@ -853,15 +856,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
}
private
void
uinbookDateList4DatePeriod
(
Map
<
String
,
List
<
String
>>
yearMonthAndDate
,
DateTime
startDay
,
DateTime
endDay
){
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)<=
0
;
curDate
=
curDate
.
plusDays
(
1
)){
private
void
unbookDateList4DatePeriod
(
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
());
yearMonthAndDate
.
put
(
curYearMonth
,
Lists
.
newArrayList
());
}
List
<
String
>
curBookedDateList
=
yearMonthAndDate
.
get
(
curYearMonth
);
curBookedDateList
.
add
(
curDateStr
);
...
...
@@ -884,14 +888,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
(),
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
(),
DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
u
inbookDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
u
nbookDateList4DatePeriod
(
yearMonthAndDate
,
DateTime
.
parse
(
startDay
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
),
DateTime
.
parse
(
endDay
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
),
DEFAULT_DATE_TIME_FORMATTER
)
);
//原设计为 读取 bookVehicleVo.getNotCheckTimeLegal(), 现在取消/拒绝 true
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getUnbookStartDate
(),
bookVehicleVo
.
getUnbookEndDate
(),
Boolean
.
TRUE
);
if
(
yearMonthAndDate
.
size
()
>
3
){
//连续的日期最多夸3个月
if
(
yearMonthAndDate
.
size
()
>
3
){
//连续的日期最多夸3个月
throw
new
BaseException
(
ResultCode
.
ONLY_UNBOOK_TWO_MONTH
);
}
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
unbookVehiclePerMonth
(
bookVehicleVo
.
getVehicleId
(),
entry
.
getValue
(),
entry
.
getKey
(),
map
);
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
rs
=
Boolean
.
FALSE
;
...
...
@@ -927,26 +931,28 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
}
public
boolean
unbookHourInfo
(
String
vehicleId
,
Map
<
String
,
Integer
>
hourInfo
,
Map
<
String
,
Object
>
params
)
{
boolean
flag
=
false
;
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
hourInfo
.
entrySet
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setYearMonthDay
(
entry
.
getKey
());
vehicleBookHourInfoDto
.
setVehicleId
(
vehicleId
);
List
<
VehicleBookHourInfo
>
vehicleBookHourInfos
=
vehicleBookHourInfoBiz
.
selectByVehicleAndDate
(
vehicleBookHourInfoDto
);
if
(
vehicleBookHourInfos
!=
null
&&
vehicleBookHourInfos
.
size
()
>
0
)
{
vehicleBookHourInfos
.
get
(
0
).
setBookedHour
((
vehicleBookHourInfos
.
get
(
0
).
getBookedHour
()
&
~
entry
.
getValue
()));
if
((
vehicleBookHourInfos
.
get
(
0
).
getBookedHour
()
&
~
entry
.
getValue
())
==
0
)
{
if
(!
flag
)
{
//解决重复执行的问题
Integer
effected
=
vehicleBookInfoMapper
.
updateBookedInfo
(
params
);
if
(
effected
<
1
)
{
return
Boolean
.
FALSE
;
}
flag
=
true
;
DateTime
dateTime
=
DateTime
.
parse
(
entry
.
getKey
(),
DEFAULT_DATE_TIME_FORMATTER
);
Integer
andOperationFactor
=
0
;
andOperationFactor
|=
1
<<
(
dateTime
.
dayOfMonth
().
get
());
VehicleBookInfo
vehicleBookInfo
=
getByVehicleIdAndYearMonth
(
vehicleId
,
dateTime
.
toString
(
YEARMONTH_DATE_TIME_FORMATTER
));
if
(
vehicleBookInfo
!=
null
)
{
vehicleBookInfo
.
setBookedDate
(
vehicleBookInfo
.
getBookedDate
()
&
~
andOperationFactor
);
int
effected
=
vehicleBookInfoBiz
.
update
(
vehicleBookInfo
);
if
(
effected
<
1
)
{
return
Boolean
.
FALSE
;
}
}
}
vehicleBookHourInfos
.
get
(
0
).
setBookedHour
((
vehicleBookHourInfos
.
get
(
0
).
getBookedHour
()
&
~
entry
.
getValue
()));
int
effect
=
vehicleBookHourInfoBiz
.
updateByIdRe
(
vehicleBookHourInfos
.
get
(
0
));
if
(
effect
<
0
)
{
if
(
effect
<
1
)
{
return
Boolean
.
FALSE
;
}
else
{
continue
;
...
...
@@ -958,6 +964,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
Boolean
.
TRUE
;
}
public
Map
<
String
,
Integer
>
getDateInfo
(
String
yearMonthDay
)
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
StringUtils
.
isNotBlank
(
yearMonthDay
))
{
DateTime
dateTime
=
DateTime
.
parse
(
yearMonthDay
,
YEARMONTH_DATE_TIME_FORMATTER
);
Integer
andOperationFactor
=
0
;
andOperationFactor
|=
1
<<(
dateTime
.
dayOfMonth
().
get
()-
1
);
map
.
put
(
dateTime
.
toString
(
YEARMONTH_DATE_TIME_FORMATTER
),
andOperationFactor
);
}
return
map
;
}
/**
* 获取某月份相应预定日期查询条件
* @param yearMonthAndDate 年月 - 预定日期条件字符串(yyyy-MM-dd)
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
View file @
2e958b5d
...
...
@@ -204,15 +204,15 @@ public class VehicleBookHourInfoBiz extends BaseBiz<VehicleBookHourInfoMapper, V
}
//
public static void main(String[] args) throws Exception{
//
VehicleBookHourInfoBiz vehicleBookHourInfoBiz = new VehicleBookHourInfoBiz();
//
Map<String, Integer> map = vehicleBookHourInfoBiz.getPredictableHours("2019-08-26 10:00:00", "2019-08-27 10:00:00", Boolean.TRUE);
//
for(Map.Entry<String, Integer> entry : map.entrySet()) {
//
System.out.println(entry.getKey());
//
System.out.println(entry.getValue());
//
}
// Integer a = 7936 & 2047
;
//
System.out.println(a);
//
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
VehicleBookHourInfoBiz
vehicleBookHourInfoBiz
=
new
VehicleBookHourInfoBiz
();
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
"2019-08-26 10:00:00"
,
"2019-08-27 10:00:00"
,
Boolean
.
TRUE
);
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
System
.
out
.
println
(
entry
.
getKey
());
System
.
out
.
println
(
entry
.
getValue
());
}
Integer
a
=
215712192
&
33554432
;
System
.
out
.
println
(
a
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookInfoBiz.java
View file @
2e958b5d
...
...
@@ -131,4 +131,8 @@ public class VehicleBookInfoBiz extends BaseBiz<VehicleBookInfoMapper, VehicleBo
public
void
InsertBatch
(
List
<
VehicleBookInfo
>
bookInfos
)
{
mapper
.
insertBatch
(
bookInfos
);
}
public
int
update
(
VehicleBookInfo
vehicleBookInfo
)
{
return
mapper
.
updateById
(
vehicleBookInfo
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleBookInfoMapper.java
View file @
2e958b5d
...
...
@@ -45,4 +45,6 @@ public interface VehicleBookInfoMapper extends Mapper<VehicleBookInfo> {
public
Integer
del4YearMoth
(
Map
<
String
,
Object
>
params
);
void
insertBatch
(
@Param
(
"vbfs"
)
List
<
VehicleBookInfo
>
bookInfos
);
public
Integer
updateById
(
VehicleBookInfo
vehicleBookInfo
);
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookInfoMapper.xml
View file @
2e958b5d
...
...
@@ -26,7 +26,6 @@
</foreach>
</select>
<insert
id=
"insertIgnore"
parameterType=
"com.xxfc.platform.vehicle.entity.VehicleBookInfo"
>
insert ignore into vehicle_book_info ( vehicle, `year_month`, booked_date)
values(#{vehicle},#{yearMonth},#{bookedDate})
...
...
@@ -47,6 +46,12 @@
vehicle = #{vehicleId} and `year_month`=#{yearMonth} and
booked_date
&
#{andOperationFactor} = #{andOperationRs}
</update>
<update
id=
"updateById"
parameterType=
"com.xxfc.platform.vehicle.entity.VehicleBookInfo"
>
update vehicle_book_info set
booked_date = #{bookedDate}
where
vehicle = #{vehicle} and `year_month`=#{yearMonth}
</update>
<select
id=
"getByPage4YearMonth"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookInfo"
>
select id, vehicle, `year_month`, booked_date, create_time, update_time from vehicle_book_info where `year_month` = #{yearMonth} order by id limit #{pageStart},#{pageSize}
...
...
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