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
aaaee09f
Commit
aaaee09f
authored
Jun 21, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://113.105.137.151:22280/youjj/cloud-platform
into base-modify
parents
00eda213
d8c803ef
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1640 additions
and
100 deletions
+1640
-100
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+75
-0
AddMsgParam.java
...src/main/java/com/xxfc/platform/im/model/AddMsgParam.java
+217
-0
Comment.java
...ver/src/main/java/com/xxfc/platform/im/model/Comment.java
+123
-0
Givegift.java
...er/src/main/java/com/xxfc/platform/im/model/Givegift.java
+160
-0
Msg.java
...-server/src/main/java/com/xxfc/platform/im/model/Msg.java
+648
-0
Praise.java
...rver/src/main/java/com/xxfc/platform/im/model/Praise.java
+76
-0
MsgController.java
...rc/main/java/com/xxfc/platform/im/rest/MsgController.java
+27
-0
BeanUtil.java
...er/src/main/java/com/xxfc/platform/im/utils/BeanUtil.java
+80
-0
VehicleBookHourInfo.java
...com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
+3
-84
BookVehicleVO.java
...in/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
+1
-1
VehicleBookHourInfoDto.java
...om/xxfc/platform/vehicle/pojo/VehicleBookHourInfoDto.java
+8
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+44
-10
VehicleBookHourInfoBiz.java
...com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
+137
-0
VehicleBookHourInfoMapper.java
...fc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
+7
-0
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+4
-4
VehicleBookHourInfoMapper.xml
...r/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
+29
-0
VehicleBookInfoMapper.xml
...erver/src/main/resources/mapper/VehicleBookInfoMapper.xml
+1
-1
No files found.
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mongodb.DBCollection
;
import
com.mongodb.DBCursor
;
import
com.mongodb.DBObject
;
import
com.xxfc.platform.im.model.Comment
;
import
com.xxfc.platform.im.model.Praise
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
MsgBiz
{
@Autowired
private
MongoTemplate
mongoTemplate
;
DBCollection
collection
;
/**
* 获取消息列表
* @param map
* @return
* @throws Exception
*/
public
Object
getMsgList
(
Map
<
String
,
Object
>
map
)
throws
Exception
{
/* PageHelper.startPage(Integer.parseInt(map.get("page").toString()),Integer.parseInt(map.get("limit").toString()));
PageInfo<Msg> goodPageInfo = new PageInfo<>(mongoTemplate.findAll(Msg.class));
Query query = new Query(Criteria.where("userId").is(10000012));
List<Msg> msg= mongoTemplate.findAll(Msg.class, "s_msg");*/
if
(
null
==
collection
)
collection
=
MGDBCollection
.
getDB
().
getCollection
(
"s_msg"
);
DBCursor
cursor
=
collection
.
find
();
//collection.find()
//return PageDataVO.pageInfo(goodPageInfo);
JSONArray
array
=
new
JSONArray
();
DBObject
dbObject
=
null
;
while
(
cursor
.
hasNext
()){
dbObject
=
cursor
.
next
();
JSONObject
json
=
fetchAndAttach
(
JSONObject
.
parseObject
(
dbObject
.
toString
()));
array
.
add
(
json
);
}
return
array
;
}
private
JSONObject
fetchAndAttach
(
JSONObject
json
)
{
//查询评论
Query
query
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
json
.
getString
(
"_id"
)));
List
<
Comment
>
msgComment
=
mongoTemplate
.
findAll
(
Comment
.
class
);
json
.
put
(
"comments"
,
msgComment
);
//查询点赞
Query
query1
=
new
Query
(
Criteria
.
where
(
"msgId"
).
is
(
json
.
getString
(
"_id"
)));
List
<
Praise
>
msgPraise
=
mongoTemplate
.
findAll
(
Praise
.
class
);
json
.
put
(
"praises"
,
msgPraise
);
/* msg.setComments(getComments(msg.getMsgId().toString()));
msg.setPraises(getPraises(msg.getMsgId().toString()));
msg.setGifts(SKBeanUtils.getMsgGiftRepository().find(msg.getMsgId(), null, 0, 10));
msg.setIsPraise(SKBeanUtils.getMsgPraiseRepository().exists(ReqUtil.getUserId(), msg.getMsgId()) ? 1 : 0);
msg.setIsCollect(SKBeanUtils.getMsgPraiseRepository().existsCollect(ReqUtil.getUserId(), msg.getMsgId()) ? 1 : 0);*/
return
json
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/AddMsgParam.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
model
;
import
java.util.List
;
public
class
AddMsgParam
extends
BaseExample
{
private
String
address
;
//地理位置
private
String
audios
;
// 语音地址
private
int
flag
;
//消息标记 :默认是3 普通消息
private
String
images
;
// 图片地址
private
String
messageId
;
// 消息id
private
String
remark
;
// 评论
private
int
source
;
// 来源
private
String
text
;
// 内容
private
long
time
;
// 发送的时间
private
String
title
;
// 标题
private
int
type
;
// 基础属性 1=文字消息、2=图文消息、3=语音消息、4=视频消息、 5=文件消息 、 6=SDK分享消息
private
String
videos
;
// 视频地址
private
String
files
;
// 文件地址
private
int
visible
=
1
;
// 默认 1 公开 2 私密 3 部分好友可见 4 不给谁看
private
String
lable
;
// 标签(目前用于短视频标签)
private
String
musicId
;
// 短视频的音乐Id
private
String
sdkUrl
;
// sdk分享url
private
String
sdkIcon
;
// sdk分享icon
private
String
sdkTitle
;
// sdk分享title
private
List
<
Integer
>
userLook
;
//谁可以看的玩家id
private
List
<
Integer
>
userNotLook
;
//谁不能看的玩家id
private
List
<
Integer
>
userRemindLook
;
//提醒谁看的玩家id
private
int
isAllowComment
;
// 是否允许评论 0:允许 1:禁止评论
public
String
getAddress
()
{
return
address
;
}
public
String
getAudios
()
{
return
audios
;
}
public
int
getFlag
()
{
return
flag
;
}
public
String
getImages
()
{
return
images
;
}
public
String
getMessageId
()
{
return
messageId
;
}
public
String
getRemark
()
{
return
remark
;
}
public
int
getSource
()
{
return
source
;
}
public
String
getText
()
{
return
text
;
}
public
long
getTime
()
{
return
time
;
}
public
String
getTitle
()
{
return
title
;
}
public
int
getType
()
{
return
type
;
}
public
String
getVideos
()
{
return
videos
;
}
public
int
getVisible
()
{
return
visible
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
void
setAudios
(
String
audios
)
{
this
.
audios
=
audios
;
}
public
void
setFlag
(
int
flag
)
{
this
.
flag
=
flag
;
}
public
void
setImages
(
String
images
)
{
this
.
images
=
images
;
}
public
void
setMessageId
(
String
messageId
)
{
this
.
messageId
=
messageId
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
void
setSource
(
int
source
)
{
this
.
source
=
source
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
void
setVideos
(
String
videos
)
{
this
.
videos
=
videos
;
}
public
void
setVisible
(
int
visible
)
{
this
.
visible
=
visible
;
}
public
List
<
Integer
>
getUserLook
()
{
return
userLook
;
}
public
void
setUserLook
(
List
<
Integer
>
userLook
)
{
this
.
userLook
=
userLook
;
}
public
List
<
Integer
>
getUserNotLook
()
{
return
userNotLook
;
}
public
void
setUserNotLook
(
List
<
Integer
>
userNotLook
)
{
this
.
userNotLook
=
userNotLook
;
}
public
List
<
Integer
>
getUserRemindLook
()
{
return
userRemindLook
;
}
public
void
setUserRemindLook
(
List
<
Integer
>
userRemindLook
)
{
this
.
userRemindLook
=
userRemindLook
;
}
public
String
getFiles
()
{
return
files
;
}
public
void
setFiles
(
String
files
)
{
this
.
files
=
files
;
}
public
String
getSdkUrl
()
{
return
sdkUrl
;
}
public
void
setSdkUrl
(
String
sdkUrl
)
{
this
.
sdkUrl
=
sdkUrl
;
}
public
String
getSdkIcon
()
{
return
sdkIcon
;
}
public
void
setSdkIcon
(
String
sdkIcon
)
{
this
.
sdkIcon
=
sdkIcon
;
}
public
String
getSdkTitle
()
{
return
sdkTitle
;
}
public
void
setSdkTitle
(
String
sdkTitle
)
{
this
.
sdkTitle
=
sdkTitle
;
}
public
String
getLable
()
{
return
lable
;
}
public
void
setLable
(
String
lable
)
{
this
.
lable
=
lable
;
}
public
String
getMusicId
()
{
return
musicId
;
}
public
void
setMusicId
(
String
musicId
)
{
this
.
musicId
=
musicId
;
}
public
int
getIsAllowComment
()
{
return
isAllowComment
;
}
public
void
setIsAllowComment
(
int
isAllowComment
)
{
this
.
isAllowComment
=
isAllowComment
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Comment.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
/**
* 朋友圈评论
* @author Administrator
*
*/
@Entity
(
value
=
"s_comment"
,
noClassnameStored
=
true
)
public
class
Comment
{
private
String
body
;
// 评论内容
private
@Id
ObjectId
commentId
;
// 评论Id
private
@Indexed
ObjectId
msgId
;
// 评论所属消息Id
private
String
nickname
;
// 评论用户昵称
private
long
time
;
// 评论时间
private
String
toBody
;
// 被回复内容
private
String
toNickname
;
// 被回复人用户昵称
private
int
toUserId
;
// 被回复用户Id
private
int
userId
;
// 评论用户Id
public
Comment
()
{
super
();
}
public
Comment
(
ObjectId
commentId
,
ObjectId
msgId
,
int
userId
,
String
nickname
,
String
body
,
int
toUserId
,
String
toNickname
,
String
toBody
,
long
time
)
{
super
();
this
.
commentId
=
commentId
;
this
.
msgId
=
msgId
;
this
.
userId
=
userId
;
this
.
nickname
=
nickname
;
this
.
body
=
body
;
this
.
toUserId
=
toUserId
;
this
.
toNickname
=
toNickname
;
this
.
toBody
=
toBody
;
this
.
time
=
time
;
}
public
String
getBody
()
{
return
body
;
}
public
ObjectId
getCommentId
()
{
return
commentId
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
long
getTime
()
{
return
time
;
}
public
String
getToBody
()
{
return
toBody
;
}
public
String
getToNickname
()
{
return
toNickname
;
}
public
int
getToUserId
()
{
return
toUserId
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
void
setCommentId
(
ObjectId
commentId
)
{
this
.
commentId
=
commentId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setToBody
(
String
toBody
)
{
this
.
toBody
=
toBody
;
}
public
void
setToNickname
(
String
toNickname
)
{
this
.
toNickname
=
toNickname
;
}
public
void
setToUserId
(
int
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
//@Override
/*public String toString() {
return JSONUtil.toJSONString(this);
}*/
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Givegift.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
import
org.mongodb.morphia.annotations.NotSaved
;
/**
* 送礼物记录
* @author Administrator
*
*/
@Entity
(
value
=
"givegift"
,
noClassnameStored
=
true
)
public
class
Givegift
{
private
@Id
ObjectId
id
;
// 送礼物记录Id
private
int
count
;
// 礼物数量
private
ObjectId
giftId
;
// 礼物Id
private
@Indexed
ObjectId
msgId
;
// 送礼物所属消息Id
private
String
nickname
;
// 送礼物用户昵称
private
Double
price
;
// 礼物价格
private
Double
actualPrice
;
// 实收金额
private
long
time
;
// 送礼物时间
private
@Indexed
int
userId
;
// 送礼物用户Id
private
int
toUserId
;
//接收礼物用户Id
@NotSaved
private
String
giftName
;
// 礼物名称
@NotSaved
private
String
liveRoomName
;
// 直播间名称
@NotSaved
private
String
userName
;
// 送礼物用户昵称
@NotSaved
private
String
toUserName
;
// 接收礼物用户昵称
public
Givegift
()
{}
public
Givegift
(
int
count
,
ObjectId
giftId
,
ObjectId
msgId
,
String
nickname
,
Double
price
,
long
time
,
int
userId
,
int
toUserId
)
{
this
.
count
=
count
;
this
.
giftId
=
giftId
;
this
.
msgId
=
msgId
;
this
.
nickname
=
nickname
;
this
.
price
=
price
;
this
.
time
=
time
;
this
.
userId
=
userId
;
this
.
toUserId
=
toUserId
;
}
public
int
getCount
()
{
return
count
;
}
public
ObjectId
getGiftId
()
{
return
giftId
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
Double
getPrice
()
{
return
price
;
}
public
long
getTime
()
{
return
time
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setCount
(
int
count
)
{
this
.
count
=
count
;
}
public
void
setGiftId
(
ObjectId
giftId
)
{
this
.
giftId
=
giftId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setPrice
(
Double
price
)
{
this
.
price
=
price
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
public
int
getToUserId
()
{
return
toUserId
;
}
public
void
setToUserId
(
int
toUserId
)
{
this
.
toUserId
=
toUserId
;
}
/*@Override
public String toString() {
return JSONUtil.toJSONString(this);
}*/
public
String
getGiftName
()
{
return
giftName
;
}
public
void
setGiftName
(
String
giftName
)
{
this
.
giftName
=
giftName
;
}
public
Double
getActualPrice
()
{
return
actualPrice
;
}
public
void
setActualPrice
(
Double
actualPrice
)
{
this
.
actualPrice
=
actualPrice
;
}
public
String
getLiveRoomName
()
{
return
liveRoomName
;
}
public
void
setLiveRoomName
(
String
liveRoomName
)
{
this
.
liveRoomName
=
liveRoomName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getToUserName
()
{
return
toUserName
;
}
public
void
setToUserName
(
String
toUserName
)
{
this
.
toUserName
=
toUserName
;
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Msg.java
0 → 100644
View file @
aaaee09f
This diff is collapsed.
Click to expand it.
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/model/Praise.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
model
;
import
org.bson.types.ObjectId
;
import
org.mongodb.morphia.annotations.Entity
;
import
org.mongodb.morphia.annotations.Id
;
import
org.mongodb.morphia.annotations.Indexed
;
@Entity
(
value
=
"s_praise"
,
noClassnameStored
=
true
)
public
class
Praise
{
private
@Indexed
ObjectId
msgId
;
// 赞所属消息Id
private
String
nickname
;
// 赞用户昵称
private
@Id
ObjectId
praiseId
;
// 赞Id
private
long
time
;
// 赞时间
private
int
userId
;
// 赞用户Id
public
Praise
()
{
super
();
}
public
Praise
(
ObjectId
praiseId
,
ObjectId
msgId
,
int
userId
,
String
nickname
,
long
time
)
{
super
();
this
.
praiseId
=
praiseId
;
this
.
msgId
=
msgId
;
this
.
userId
=
userId
;
this
.
nickname
=
nickname
;
this
.
time
=
time
;
}
public
ObjectId
getMsgId
()
{
return
msgId
;
}
public
String
getNickname
()
{
return
nickname
;
}
public
ObjectId
getPraiseId
()
{
return
praiseId
;
}
public
long
getTime
()
{
return
time
;
}
public
int
getUserId
()
{
return
userId
;
}
public
void
setMsgId
(
ObjectId
msgId
)
{
this
.
msgId
=
msgId
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
;
}
public
void
setPraiseId
(
ObjectId
praiseId
)
{
this
.
praiseId
=
praiseId
;
}
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
}
public
void
setUserId
(
int
userId
)
{
this
.
userId
=
userId
;
}
/*@Override
public String toString() {
return JSONUtil.toJSONString(this);
}*/
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/rest/MsgController.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
rest
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.mongodb.DBCursor
;
import
com.xxfc.platform.im.biz.MsgBiz
;
import
com.xxfc.platform.im.biz.UserBiz
;
import
com.xxfc.platform.im.model.Msg
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"msg"
)
public
class
MsgController
{
@Autowired
private
MsgBiz
msgBiz
;
@RequestMapping
(
value
=
"/app/unauth/list"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
getMsgList
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
//@RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "limit", required = true) Integer limit
return
msgBiz
.
getMsgList
(
map
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/utils/BeanUtil.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
im
.
utils
;
import
com.mongodb.DBObject
;
import
org.apache.commons.beanutils.BeanUtils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
public
class
BeanUtil
{
/**
* 将DBObject转换成Bean对象
*
*/
public
static
<
T
>
T
dbObjectToBean
(
DBObject
dbObject
,
T
bean
)
throws
IllegalAccessException
,
InvocationTargetException
,
NoSuchMethodException
{
if
(
bean
==
null
)
{
return
null
;
}
Field
[]
fields
=
bean
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
String
varName
=
field
.
getName
();
Object
object
=
dbObject
.
get
(
varName
);
if
(
object
!=
null
)
{
org
.
apache
.
commons
.
beanutils
.
BeanUtils
.
setProperty
(
bean
,
varName
,
object
);
}
}
return
bean
;
}
// 取出Mongo中的属性值,为bean赋值
public
static
<
T
>
void
setProperty
(
T
bean
,
String
varName
,
T
object
)
{
varName
=
varName
.
substring
(
0
,
1
).
toUpperCase
()
+
varName
.
substring
(
1
);
try
{
String
type
=
object
.
getClass
().
getName
();
// 类型为String
if
(
type
.
equals
(
"java.lang.String"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
()
.
getMethod
(
"set"
+
varName
,
String
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
// 类型为Integer
if
(
type
.
equals
(
"java.lang.Integer"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
().
getMethod
(
"set"
+
varName
,
Integer
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
// 类型为Boolean
if
(
type
.
equals
(
"java.lang.Boolean"
))
{
Method
m
=
bean
.
getClass
().
getMethod
(
"get"
+
varName
);
String
value
=
(
String
)
m
.
invoke
(
bean
);
if
(
value
==
null
)
{
m
=
bean
.
getClass
().
getMethod
(
"set"
+
varName
,
Boolean
.
class
);
m
.
invoke
(
bean
,
object
);
}
}
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalArgumentException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleBookHourInfo.java
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
@Table
(
name
=
"vehicle_book_hour_info"
)
@Data
public
class
VehicleBookHourInfo
{
@Id
private
Integer
id
;
...
...
@@ -24,88 +27,4 @@ public class VehicleBookHourInfo {
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
/**
* @return id
*/
public
Integer
getId
()
{
return
id
;
}
/**
* @param id
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* @return vehicle_id
*/
public
String
getVehicleId
()
{
return
vehicleId
;
}
/**
* @param vehicleId
*/
public
void
setVehicleId
(
String
vehicleId
)
{
this
.
vehicleId
=
vehicleId
;
}
/**
* @return year_month_day
*/
public
String
getYearMonthDay
()
{
return
yearMonthDay
;
}
/**
* @param yearMonthDay
*/
public
void
setYearMonthDay
(
String
yearMonthDay
)
{
this
.
yearMonthDay
=
yearMonthDay
;
}
/**
* @return booked_hour
*/
public
Integer
getBookedHour
()
{
return
bookedHour
;
}
/**
* @param bookedHour
*/
public
void
setBookedHour
(
Integer
bookedHour
)
{
this
.
bookedHour
=
bookedHour
;
}
/**
* @return create_time
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* @param createTime
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* @return update_time
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
/**
* @param updateTime
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BookVehicleVO.java
View file @
aaaee09f
...
...
@@ -11,7 +11,7 @@ public class BookVehicleVO {
* 车辆id
*/
@ApiModelProperty
(
"车辆id"
)
private
String
vehicle
;
private
String
vehicle
Id
;
/**
* 预定目标日期(开始)
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleBookHourInfoDto.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
lombok.Data
;
@Data
public
class
VehicleBookHourInfoDto
extends
VehicleBookHourInfo
{
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
aaaee09f
...
...
@@ -63,7 +63,8 @@ import java.util.stream.Collectors;
@Slf4j
public
class
VehicleBiz
extends
BaseBiz
<
VehicleMapper
,
Vehicle
>
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
static
final
DateTimeFormatter
YEARMONTH_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM"
);
/**
* 允许查询预定信息的最大月份数
...
...
@@ -82,7 +83,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
@Autowired
private
RedisTemplate
customRedisTemplate
;
@Autowired
private
VehicleBookHourInfoBiz
vehicleBookHourInfoBiz
;
@Value
(
"${vehicle.baseUploadPath}"
)
private
String
baseUploadPath
;
...
...
@@ -286,10 +288,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Transactional
public
VehicleBookRecord
applyVehicle4Employee
(
Integer
userId
,
BookVehicleVO
bookVehicleVo
,
String
userName
)
throws
Exception
{
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicle
());
checkIfVehicleExists
(
bookVehicleVo
.
getVehicle
Id
());
//提取日期和相应的预定目标日期
Map
<
String
,
List
<
String
>>
yearMonthAndDate
=
Maps
.
newHashMap
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookStartDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getBookEndDate
(),
DEFAULT_DATE_TIME_FORMATTER
);
//转换日期范围为列表,并检查是否合法
fillDateList4DatePeriod
(
yearMonthAndDate
,
startDay
,
endDay
);
...
...
@@ -297,14 +299,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
throw
new
CustomIllegalParamException
(
" you can only within 2 month"
);
}
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
applyVehicle4EmployeePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
//加入预定申请记录
VehicleBookRecord
vehicleBookRecord
=
new
VehicleBookRecord
();
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicle
());
vehicleBookRecord
.
setVehicleId
(
bookVehicleVo
.
getVehicle
Id
());
vehicleBookRecord
.
setBookType
(
BookType
.
EMPLOYEE_APPLY
.
getCode
());
vehicleBookRecord
.
setStatus
(
VehicleBookRecordStatus
.
APPLY
.
getCode
());
vehicleBookRecord
.
setBookUser
(
userId
);
...
...
@@ -319,6 +322,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
vehicleBookRecord
.
setLiftCompany
(
bookVehicleVo
.
getLiftCompany
());
vehicleBookRecordMapper
.
insertSelective
(
vehicleBookRecord
);
//添加预定时间记录
Map
<
String
,
Integer
>
map
=
vehicleBookHourInfoBiz
.
getPredictableHours
(
bookVehicleVo
.
getBookStartDate
(),
bookVehicleVo
.
getBookEndDate
());
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
VehicleBookHourInfoDto
vehicleBookHourInfoDto
=
new
VehicleBookHourInfoDto
();
vehicleBookHourInfoDto
.
setVehicleId
(
bookVehicleVo
.
getVehicleId
());
vehicleBookHourInfoDto
.
setYearMonthDay
(
entry
.
getKey
());
vehicleBookHourInfoDto
.
setBookedHour
(
entry
.
getValue
());
vehicleBookHourInfoBiz
.
save
(
vehicleBookHourInfoDto
);
}
//修改相关车辆预定记录
Boolean
hasSuc
=
bookedVehicle
(
bookVehicleVo
);
if
(!
hasSuc
){
...
...
@@ -392,6 +406,15 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
// return RestResponse.code(ResCode.VEHICLE_BOOKED_INFO_ALREADY_CHANGED.getCode());
// }
// }
//如果拒绝预定,删除预定时间记录
if
(
VehicleBookRecordStatus
.
APPLY
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
()))
{
//删除预定时间记录
List
<
String
>
list
=
null
;
for
(
DateTime
curDate
=
new
DateTime
(
vehicleBookRecord
.
getBookStartDate
());
curDate
.
compareTo
(
new
DateTime
(
vehicleBookRecord
.
getBookEndDate
()))<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
list
.
add
(
curDate
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
));
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
}
//成功后修改预定记录状态
Map
<
String
,
Object
>
updateParam
=
Maps
.
newHashMap
();
updateParam
.
put
(
"id"
,
bookRecordId
);
...
...
@@ -419,6 +442,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
if
(
vehicleBookRecord
==
null
){
throw
new
CustomIllegalParamException
(
" invalid book record"
);
}
//已通过审核的可以取消预定
if
(!
VehicleBookRecordStatus
.
APPROVE
.
getCode
().
equals
(
vehicleBookRecord
.
getStatus
())){
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
...
...
@@ -446,6 +470,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
//删除预定时间记录
List
<
String
>
list
=
Lists
.
newArrayList
();
DateTime
startDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookStartDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookVehicleVo
.
getUnbookEndDate
().
split
(
" "
)[
0
],
DATE_TIME_FORMATTER
);
for
(
DateTime
curDate
=
startDay
;
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
log
.
info
(
"当前日期:"
+
curDate
);
String
date
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
list
.
add
(
date
);
}
vehicleBookHourInfoBiz
.
delete
(
vehicleBookRecord
.
getVehicleId
(),
list
);
return
RestResponse
.
suc
();
}
...
...
@@ -498,7 +532,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
bookedVehiclePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
bookedVehiclePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
rs
=
Boolean
.
FALSE
;
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
...
...
@@ -528,7 +562,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
Integer
effected
=
vehicleBookInfoMapper
.
insertIgnore
(
vehicleBookInfo
);
if
(
effected
==
0
){
//已存在则需要更新
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"vehicle"
,
vehicleBookInfo
.
getVehicle
());
params
.
put
(
"vehicle
Id
"
,
vehicleBookInfo
.
getVehicle
());
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
bookedDates
)){
...
...
@@ -606,7 +640,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
Boolean
rs
=
Boolean
.
TRUE
;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry:
yearMonthAndDate
.
entrySet
()){
Boolean
rsEach
=
unbookVehiclePerMonth
(
bookVehicleVo
.
getVehicle
(),
entry
.
getValue
(),
entry
.
getKey
());
Boolean
rsEach
=
unbookVehiclePerMonth
(
bookVehicleVo
.
getVehicle
Id
(),
entry
.
getValue
(),
entry
.
getKey
());
if
(
Boolean
.
FALSE
.
equals
(
rsEach
)){
rs
=
Boolean
.
FALSE
;
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
...
...
@@ -619,7 +653,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
public
Boolean
unbookVehiclePerMonth
(
String
vehicleId
,
List
<
String
>
unbookDates
,
String
yearMonth
){
checkIfVehicleExists
(
vehicleId
);
Map
<
String
,
Object
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"vehicle"
,
vehicleId
);
params
.
put
(
"vehicle
Id
"
,
vehicleId
);
params
.
put
(
"yearMonth"
,
yearMonth
);
//加入更新条件
if
(
CollectionUtils
.
isEmpty
(
unbookDates
)){
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookHourInfoBiz.java
0 → 100644
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.vehicle.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper
;
import
com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
public
class
VehicleBookHourInfoBiz
extends
BaseBiz
<
VehicleBookHourInfoMapper
,
VehicleBookHourInfo
>
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
Map
<
String
,
Integer
>
getPredictableHours
(
String
bookStartdate
,
String
bookEndDate
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
startDate
=
null
;
Date
endDate
=
null
;
try
{
startDate
=
simpleDateFormat
.
parse
(
bookStartdate
);
endDate
=
simpleDateFormat
.
parse
(
bookEndDate
);
}
catch
(
Exception
e
)
{
}
//判定时间是否合法
if
(
bookStartdate
.
compareTo
(
DateTime
.
now
().
toString
(
DEFAULT_DATE_TIME_FORMATTER
))
<
0
)
{
throw
new
CustomIllegalParamException
(
"you can only book from today"
);
}
if
(
bookStartdate
.
compareTo
(
bookEndDate
)
>
0
)
{
throw
new
CustomIllegalParamException
(
"预定开始日期不能大于结束日期!"
);
}
Map
<
String
,
Integer
>
predictableHours
=
Maps
.
newHashMap
();
//预定开始小时
int
hour
=
new
DateTime
(
startDate
).
hourOfDay
().
get
();
int
endHour
=
new
DateTime
(
endDate
).
hourOfDay
().
get
();
//获取开始天的预定小时
int
startPredictableHour
=
0
;
for
(
int
curentHour
=
hour
;
curentHour
<
24
;
curentHour
++)
{
startPredictableHour
|=
1
<<
(
curentHour
-
1
);
}
//获取结束天的预定小时
int
endPredictableHour
=
0
;
for
(
int
curentHour
=
0
;
curentHour
<
endHour
;
curentHour
++)
{
endPredictableHour
|=
1
<<
(
curentHour
);
}
predictableHours
.
put
(
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
startPredictableHour
);
predictableHours
.
put
(
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
).
toString
(
DATE_TIME_FORMATTER
),
endPredictableHour
);
DateTime
startDay
=
DateTime
.
parse
(
bookStartdate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
bookEndDate
,
DEFAULT_DATE_TIME_FORMATTER
);
if
(
startDay
.
getHourOfDay
()
-
endDay
.
getHourOfDay
()
>
1
){
//
for
(
DateTime
curDate
=
startDay
.
plusDays
(
1
);
curDate
.
compareTo
(
endDay
)
<=
0
;
curDate
=
curDate
.
plusDays
(
1
))
{
String
curDateStr
=
curDate
.
toString
(
DATE_TIME_FORMATTER
);
//全天预定
predictableHours
.
put
(
curDateStr
,
16777215
);
}
}
return
predictableHours
;
}
// public static void main(String[] args) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date startDate = null;
// Date endDate = null;
// try{
// startDate = simpleDateFormat.parse("2019-06-21 16:30:30");
// endDate = simpleDateFormat.parse("2019-06-22 12:30:30");
// }catch (Exception e) {
//
// }
// Map<String, Integer> map = getPredictableHours(startDate, endDate);
// for(Map.Entry<String, Integer> entry : map.entrySet()) {
// System.out.println(entry.getKey());
// System.out.println(entry.getValue());
// }
// }
@Transactional
public
ObjectRestResponse
save
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
)
{
if
(
vehicleBookHourInfoDto
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
502
,
"参数为空"
);
}
List
<
VehicleBookHourInfo
>
vehicleBookHourInfos
=
mapper
.
selectByVehicleAndDate
(
vehicleBookHourInfoDto
);
//有数据直接更新
if
(
vehicleBookHourInfos
.
size
()
>=
1
)
{
for
(
VehicleBookHourInfo
vehicleBookHourInfo
:
vehicleBookHourInfos
)
{
if
(
vehicleBookHourInfo
.
getBookedHour
().
equals
(
vehicleBookHourInfoDto
.
getBookedHour
()))
{
return
ObjectRestResponse
.
createFailedResult
(
504
,
"当天时间段已经被预定"
);
}
else
{
vehicleBookHourInfo
.
setBookedHour
(
vehicleBookHourInfo
.
getBookedHour
()
|
vehicleBookHourInfoDto
.
getBookedHour
());
mapper
.
updateByPrimaryKeySelective
(
vehicleBookHourInfo
);
}
}
return
ObjectRestResponse
.
succ
();
}
//没有数据直接添加
mapper
.
insertSelective
(
vehicleBookHourInfoDto
);
return
ObjectRestResponse
.
succ
();
}
/**
* 删除预定车辆小时记录信息
* @param vehicleId 车辆Id
* @param dateList 日期列表
* @return
*/
@Transactional
public
ObjectRestResponse
delete
(
String
vehicleId
,
List
<
String
>
dateList
)
{
if
(
StringUtils
.
isBlank
(
vehicleId
)
||
dateList
.
size
()
<=
0
)
{
return
ObjectRestResponse
.
createFailedResult
(
502
,
"删除信息车辆Id为空"
);
}
Map
<
String
,
Object
>
param
=
Maps
.
newHashMap
();
param
.
put
(
"vehicleId"
,
vehicleId
);
param
.
put
(
"list"
,
dateList
);
List
<
VehicleBookHourInfo
>
list
=
mapper
.
selectByVehicleAndDateList
(
param
);
list
.
forEach
((
a
)
->
mapper
.
delete
(
a
));
return
ObjectRestResponse
.
succ
();
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleBookHourInfoMapper.java
View file @
aaaee09f
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
import
com.xxfc.platform.vehicle.entity.VehicleBookHourInfo
;
import
com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
public
interface
VehicleBookHourInfoMapper
extends
Mapper
<
VehicleBookHourInfo
>
{
List
<
VehicleBookHourInfo
>
selectByVehicleAndDate
(
VehicleBookHourInfoDto
vehicleBookHourInfoDto
);
List
<
VehicleBookHourInfo
>
selectByVehicleAndDateList
(
Map
<
String
,
Object
>
param
);
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
aaaee09f
...
...
@@ -185,7 +185,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
*/
@RequestMapping
(
value
=
"/book/4employee"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"申请预定车辆信息"
)
public
RestResponse
<
Integer
>
applyVehicle
(
@RequestBody
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
public
RestResponse
<
Integer
>
applyVehicle
(
BookVehicleVO
bookVehicleVo
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
...
...
@@ -374,11 +374,11 @@ public class VehicleController extends BaseController<VehicleBiz> {
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
}
bookVehicleVo
.
setVehicle
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
bookVehicleVo
.
setVehicle
Id
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
VehicleBookRecord
vehicleBookRecord
=
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
return
ObjectRestResponse
.
succ
(
vehicleBookRecord
);
return
ObjectRestResponse
.
succ
(
bookVehicleVo
.
getVehicleId
()
);
}
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookHourInfoMapper.xml
0 → 100644
View file @
aaaee09f
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.xxfc.platform.vehicle.mapper.VehicleBookHourInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"vehicle_id"
property=
"vehicleId"
jdbcType=
"VARCHAR"
/>
<result
column=
"year_month_day"
property=
"yearMonthDay"
jdbcType=
"VARCHAR"
/>
<result
column=
"booked_hour"
property=
"bookedHour"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<select
id=
"selectByVehicleAndDate"
parameterType=
"com.xxfc.platform.vehicle.pojo.VehicleBookHourInfoDto"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day = #{yearMonthDay}
</select>
<select
id=
"selectByVehicleAndDateList"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.VehicleBookHourInfo"
>
select * from vehicle_book_hour_info
where vehicle_id = #{vehicleId} and year_month_day in
<foreach
collection=
"list"
item=
"yearMonthDay"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{yearMonthDay}
</foreach>
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookInfoMapper.xml
View file @
aaaee09f
...
...
@@ -44,7 +44,7 @@
</choose>
where
vehicle = #{vehicle} and `year_month`=#{yearMonth} and
vehicle = #{vehicle
Id
} and `year_month`=#{yearMonth} and
booked_date
&
#{andOperationFactor} = #{andOperationRs}
</update>
...
...
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