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
643572c6
Commit
643572c6
authored
Apr 20, 2019
by
164003836@qq.con
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加扯脸信息字段
parent
2577fce7
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
623 additions
and
85 deletions
+623
-85
VehicleBiz.java
...ava/com/xinxincaravan/caravan/vehicle/biz/VehicleBiz.java
+57
-5
VehicleBookRecordBiz.java
...nxincaravan/caravan/vehicle/biz/VehicleBookRecordBiz.java
+19
-34
RestResponse.java
...om/xinxincaravan/caravan/vehicle/common/RestResponse.java
+6
-0
BranchCompanyStatus.java
...caravan/caravan/vehicle/constant/BranchCompanyStatus.java
+55
-0
RedisKey.java
.../com/xinxincaravan/caravan/vehicle/constant/RedisKey.java
+5
-0
VehicleBelong2Type.java
...ncaravan/caravan/vehicle/constant/VehicleBelong2Type.java
+56
-0
BranchCompany.java
...m/xinxincaravan/caravan/vehicle/entity/BranchCompany.java
+23
-4
Vehicle.java
...ava/com/xinxincaravan/caravan/vehicle/entity/Vehicle.java
+29
-6
VehicleBookRecord.java
...nxincaravan/caravan/vehicle/entity/VehicleBookRecord.java
+16
-0
CorsInterceptor.java
...ncaravan/caravan/vehicle/interceptor/CorsInterceptor.java
+0
-1
VehicleBookRecordMapper.java
...ravan/caravan/vehicle/mapper/VehicleBookRecordMapper.java
+2
-1
VehicleController.java
...xinxincaravan/caravan/vehicle/rest/VehicleController.java
+34
-1
AddOrUpdateVehicleVo.java
...inxincaravan/caravan/vehicle/vo/AddOrUpdateVehicleVo.java
+25
-6
BookVehicleVo.java
...a/com/xinxincaravan/caravan/vehicle/vo/BookVehicleVo.java
+16
-0
BranchCompanyVo.java
...com/xinxincaravan/caravan/vehicle/vo/BranchCompanyVo.java
+12
-0
LiftVehicleVo.java
...a/com/xinxincaravan/caravan/vehicle/vo/LiftVehicleVo.java
+5
-0
QueryVehicleBookRecordVo.java
...ncaravan/caravan/vehicle/vo/QueryVehicleBookRecordVo.java
+15
-0
QueryVehicleVo.java
.../com/xinxincaravan/caravan/vehicle/vo/QueryVehicleVo.java
+27
-6
RetVehicleVo.java
...va/com/xinxincaravan/caravan/vehicle/vo/RetVehicleVo.java
+9
-0
VehicleBookRecordAndTbNameVo.java
...avan/caravan/vehicle/vo/VehicleBookRecordAndTbNameVo.java
+167
-0
application.yml
vehicle/src/main/resources/application.yml
+1
-1
VehicleBookRecordMapper.xml
...cle/src/main/resources/mapper/VehicleBookRecordMapper.xml
+37
-1
VehicleMapper.xml
vehicle/src/main/resources/mapper/VehicleMapper.xml
+7
-19
No files found.
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/biz/VehicleBiz.java
View file @
643572c6
...
...
@@ -7,11 +7,8 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.xinxincaravan.caravan.vehicle.common.CustomIllegalParamException
;
import
com.xinxincaravan.caravan.vehicle.common.RestResponse
;
import
com.xinxincaravan.caravan.vehicle.constant.BookType
;
import
com.xinxincaravan.caravan.vehicle.constant.ConstantType
;
import
com.xinxincaravan.caravan.vehicle.constant.*
;
import
com.xinxincaravan.caravan.vehicle.constant.ResCode.ResCode
;
import
com.xinxincaravan.caravan.vehicle.constant.VehicleBookRecordStatus
;
import
com.xinxincaravan.caravan.vehicle.constant.VehicleStatus
;
import
com.xinxincaravan.caravan.vehicle.entity.Vehicle
;
import
com.xinxincaravan.caravan.vehicle.entity.VehicleBookInfo
;
import
com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord
;
...
...
@@ -25,16 +22,27 @@ import org.apache.commons.beanutils.BeanUtils;
import
org.apache.commons.beanutils.PropertyUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.io.FileUtils
;
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.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
@Slf4j
...
...
@@ -57,12 +65,56 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
private
BranchCompanyBiz
branchCompanyBiz
;
@Autowired
private
BookRecordAccItemMapper
bookRecordAccItemMapper
;
@Autowired
private
RedisTemplate
customRedisTemplate
;
@Value
(
"${vehicle.baseUploadPath}"
)
private
String
baseUploadPath
;
/**
* 每批次最大更、插入车辆最大条目数
*/
public
static
final
Integer
MAX_BATCH_SIZE_VEHICLE
=
1
;
//使用了悲观锁,不开放批量更新
/**
* 写入上传文件,返回相对路径
* @param file
* @param vehicleId
* @return
*/
public
RestResponse
<
String
>
uploadDrivingLicense
(
MultipartFile
file
)
throws
Exception
{
//创建本日存放目录
DateTime
now
=
DateTime
.
now
();
String
dirPathToday
=
File
.
separator
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
Long
no
=
customRedisTemplate
.
opsForValue
().
increment
(
redisNoKey
);
if
(
no
.
equals
(
1
l
)){
customRedisTemplate
.
expire
(
redisNoKey
,
1
,
TimeUnit
.
DAYS
);
}
String
fileName
=
file
.
getOriginalFilename
();
String
realFileRelPath
=
dirPathToday
+
File
.
separator
+
no
+
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
//文件存放路径
String
filePath
=
baseUploadPath
+
realFileRelPath
;
//将文件写入指定位置
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
return
RestResponse
.
suc
(
realFileRelPath
);
}
/**
* 下载行驶证图片
* @param realFileRelPath
* @return
* @throws Exception
*/
public
ResponseEntity
<
byte
[]>
downloadDrivingLicense
(
String
realFileRelPath
)
throws
Exception
{
String
filePath
=
baseUploadPath
+
realFileRelPath
;
File
file
=
new
File
(
filePath
);
//新建一个文件
HttpHeaders
headers
=
new
HttpHeaders
();
//http头信息
String
downloadFileName
=
new
String
(
file
.
getName
());
//设置编码
headers
.
setContentDispositionFormData
(
"attachment"
,
downloadFileName
);
headers
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM
);
return
new
ResponseEntity
<
byte
[]>(
FileUtils
.
readFileToByteArray
(
file
),
headers
,
HttpStatus
.
CREATED
);
}
public
Vehicle
get
(
String
id
){
return
mapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -216,7 +268,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
* @return
*/
@Transactional
public
RestResponse
applyVehicle4Employee
(
Integer
userId
,
BookVehicleVo
bookVehicleVo
,
String
userName
){
public
RestResponse
applyVehicle4Employee
(
Integer
userId
,
BookVehicleVo
bookVehicleVo
,
String
userName
)
throws
Exception
{
//检查车辆信息是否合法
checkIfVehicleExists
(
bookVehicleVo
.
getVehicle
());
//提取日期和相应的预定目标日期
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/biz/VehicleBookRecordBiz.java
View file @
643572c6
...
...
@@ -79,6 +79,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
params
.
put
(
"reviewerNameLift"
,
userName
);
params
.
put
(
"targetStatus"
,
VehicleBookRecordStatus
.
LIFTED
.
getCode
());
params
.
put
(
"conditionStatus"
,
VehicleBookRecordStatus
.
APPROVE
.
getCode
());
params
.
put
(
"mileageLift"
,
liftVehicleVo
.
getMileageLift
());
Integer
effected
=
mapper
.
liftOrRet
(
params
);
if
(
effected
==
0
){
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_STATUS_CHANGED
.
getCode
());
...
...
@@ -92,6 +93,8 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
params
.
put
(
"conditionStatus"
,
VehicleBookRecordStatus
.
LIFTED
.
getCode
());
params
.
put
(
"reviewerReturn"
,
operatorId
);
params
.
put
(
"reviewerNameReturn"
,
userName
);
params
.
put
(
"mileageRet"
,
retVehicleVo
.
getMileageRet
());
params
.
put
(
"haveViolation"
,
retVehicleVo
.
getHaveViolation
());
Integer
effected
=
mapper
.
liftOrRet
(
params
);
if
(
effected
==
0
){
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_STATUS_CHANGED
.
getCode
());
...
...
@@ -172,13 +175,17 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
*/
@Scheduled
(
cron
=
"0 0 1 1 * ?"
)
//每月1号1点触发
public
void
transfer2HistoryTb
(){
//获取表格名称
DateTime
now
=
DateTime
.
now
();
//当前获取的时间为标准
log
.
info
(
"开始预定记录迁移至历史表的定时任务。"
);
Boolean
needRun
=
copyDataLastMoth
(
now
);
if
(
needRun
)
{
//每月初将上上月数据从当前信息表中删除
delDataTheMonthBeforeLast
(
now
);
try
{
//获取表格名称
DateTime
now
=
DateTime
.
now
();
//当前获取的时间为标准
log
.
info
(
"开始预定记录迁移至历史表的定时任务。"
);
Boolean
needRun
=
copyDataLastMoth
(
now
);
if
(
needRun
)
{
//每月初将上上月数据从当前信息表中删除
delDataTheMonthBeforeLast
(
now
);
}
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
());
}
}
...
...
@@ -188,7 +195,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
* 获取上月数据,并复制到历史表
*/
@Transactional
public
Boolean
copyDataLastMoth
(
DateTime
now
){
public
Boolean
copyDataLastMoth
(
DateTime
now
)
throws
Exception
{
String
lastMonthStr
=
now
.
plusMonths
(-
1
).
toString
(
YEARMONTH_DATE_TIME_FORMATTER
);
String
redisKey
=
RedisKey
.
TRANSFER_BOOK_RECORD_LOCK_PREFIX
+
lastMonthStr
;
String
tbName
=
getTbName
(
now
.
plusMonths
(-
1
).
toString
(
"yyyy"
));
...
...
@@ -217,32 +224,10 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if
(
CollectionUtils
.
isNotEmpty
(
vehicleBookRecords
)){
//插入数据到历史表
for
(
VehicleBookRecord
vehicleBookRecord
:
vehicleBookRecords
){
Map
<
String
,
Object
>
insertHisParams
=
Maps
.
newHashMap
();
insertHisParams
.
put
(
"tbName"
,
tbName
);
insertHisParams
.
put
(
"id"
,
vehicleBookRecord
.
getId
());
insertHisParams
.
put
(
"vehicle"
,
vehicleBookRecord
.
getVehicle
());
insertHisParams
.
put
(
"status"
,
vehicleBookRecord
.
getStatus
());
insertHisParams
.
put
(
"bookType"
,
vehicleBookRecord
.
getBookType
());
insertHisParams
.
put
(
"bookUser"
,
vehicleBookRecord
.
getBookUser
());
insertHisParams
.
put
(
"contactInfo"
,
vehicleBookRecord
.
getContactInfo
());
insertHisParams
.
put
(
"bookStartDate"
,
vehicleBookRecord
.
getBookStartDate
());
insertHisParams
.
put
(
"bookEndDate"
,
vehicleBookRecord
.
getBookEndDate
());
insertHisParams
.
put
(
"liftLocation"
,
vehicleBookRecord
.
getLiftLocation
());
insertHisParams
.
put
(
"liftAddr"
,
vehicleBookRecord
.
getLiftAddr
());
insertHisParams
.
put
(
"remark"
,
vehicleBookRecord
.
getRemark
());
insertHisParams
.
put
(
"destination"
,
vehicleBookRecord
.
getDestination
());
insertHisParams
.
put
(
"reviewerApply"
,
vehicleBookRecord
.
getReviewerApply
());
insertHisParams
.
put
(
"reviewerReturn"
,
vehicleBookRecord
.
getReviewerReturn
());
insertHisParams
.
put
(
"reviewerCancel"
,
vehicleBookRecord
.
getReviewerCancel
());
insertHisParams
.
put
(
"actualStartDate"
,
vehicleBookRecord
.
getActualStartDate
());
insertHisParams
.
put
(
"actualEndDate"
,
vehicleBookRecord
.
getActualEndDate
());
insertHisParams
.
put
(
"reviewerLift"
,
vehicleBookRecord
.
getReviewerLift
());
insertHisParams
.
put
(
"reviewerNameLift"
,
vehicleBookRecord
.
getReviewerNameLift
());
insertHisParams
.
put
(
"liftCompany"
,
vehicleBookRecord
.
getLiftCompany
());
insertHisParams
.
put
(
"liftRemark"
,
vehicleBookRecord
.
getLiftRemark
());
insertHisParams
.
put
(
"retCompany"
,
vehicleBookRecord
.
getRetCompany
());
insertHisParams
.
put
(
"retRemark"
,
vehicleBookRecord
.
getRetRemark
());
mapper
.
insertHis
(
insertHisParams
);
VehicleBookRecordAndTbNameVo
vehicleBookRecordAndTbNameVo
=
new
VehicleBookRecordAndTbNameVo
();
BeanUtils
.
copyProperties
(
vehicleBookRecordAndTbNameVo
,
vehicleBookRecord
);
vehicleBookRecordAndTbNameVo
.
setTbName
(
tbName
);
mapper
.
insertHis
(
vehicleBookRecordAndTbNameVo
);
}
}
curPageNo
++;
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/common/RestResponse.java
View file @
643572c6
...
...
@@ -44,6 +44,12 @@ public class RestResponse<T> extends BaseResponse {
return
new
RestResponse
<
M
>();
}
public
static
<
M
>
RestResponse
<
M
>
suc
(
M
data
){
RestResponse
<
M
>
restResponse
=
new
RestResponse
<
M
>();
restResponse
.
setData
(
data
);
return
restResponse
;
}
public
static
<
M
>
RestResponse
<
M
>
code
(
Integer
code
){
RestResponse
<
M
>
restResponse
=
new
RestResponse
<
M
>();
restResponse
.
setCode
(
code
);
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/constant/BranchCompanyStatus.java
0 → 100644
View file @
643572c6
package
com
.
xinxincaravan
.
caravan
.
vehicle
.
constant
;
import
com.google.common.collect.Maps
;
import
java.util.Map
;
public
enum
BranchCompanyStatus
{
PREPARING
(
1
,
"筹备中"
),
SOFT_OPING
(
2
,
"试业中"
),
ADD_SELECTION
(
3
,
"选址中"
),
OPEN
(
4
,
"已开业"
),
RENOVATION
(
5
,
"装修中"
),
;
/**
* 编码
*/
private
Integer
code
;
/**
* 类型描述
*/
private
String
desc
;
private
static
Map
<
Integer
,
String
>
codeAndDesc
=
Maps
.
newHashMap
();
static
{
for
(
VehicleBookRecordStatus
constantType
:
VehicleBookRecordStatus
.
values
()){
codeAndDesc
.
put
(
constantType
.
getCode
(),
constantType
.
getDesc
());
}
}
BranchCompanyStatus
(
Integer
code
,
String
desc
){
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
static
Boolean
exists
(
Integer
code
){
return
codeAndDesc
.
containsKey
(
code
);
}
}
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/constant/RedisKey.java
View file @
643572c6
...
...
@@ -46,4 +46,9 @@ public class RedisKey {
// 随车物品相关key
public
static
final
String
ACCOMPANYING_ITEM_CACHE_ALL
=
"cache:accompanyItem:all"
;
/**
* 服务器上传文件序号
*/
public
static
final
String
UPLOAD_FILE_NO_PREFIX
=
"upload:file:no:"
;
}
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/constant/VehicleBelong2Type.java
0 → 100644
View file @
643572c6
package
com
.
xinxincaravan
.
caravan
.
vehicle
.
constant
;
import
com.google.common.collect.Maps
;
import
java.util.Map
;
public
enum
VehicleBelong2Type
{
OWN
(
1
,
"欣新房车有限公司"
),
//自有
TRUST
(
2
,
"托管"
),
RENTAL
(
3
,
"租赁"
),
;
/**
* 编码
*/
private
Integer
code
;
/**
* 类型描述
*/
private
String
desc
;
private
static
Map
<
Integer
,
String
>
codeAndDesc
=
Maps
.
newHashMap
();
static
{
for
(
VehicleBelong2Type
constantType
:
VehicleBelong2Type
.
values
()){
codeAndDesc
.
put
(
constantType
.
getCode
(),
constantType
.
getDesc
());
}
}
VehicleBelong2Type
(
Integer
code
,
String
desc
){
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
static
Boolean
exists
(
Integer
code
){
return
codeAndDesc
.
containsKey
(
code
);
}
}
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/entity/BranchCompany.java
View file @
643572c6
...
...
@@ -6,6 +6,7 @@ import javax.persistence.Column;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Table
(
name
=
"branch_company"
)
...
...
@@ -32,10 +33,6 @@ public class BranchCompany {
@Column
(
name
=
"subordinate_branch"
)
private
Integer
subordinateBranch
;
/**
* 分支机构地址:经纬度
*/
private
String
location
;
/**
* 地址-省/直辖市(编码)
...
...
@@ -65,5 +62,27 @@ public class BranchCompany {
private
Date
updateTime
;
/**
* 负责人
*/
private
String
leader
;
/**
* 负责人联系方式
*/
private
String
leaderContactInfo
;
/**
* 分公司状态
*/
private
Integer
status
;
/**
*公司地址-纬度
*/
private
BigDecimal
latitude
;
/**
* 公司地址-经度
*/
private
BigDecimal
longitude
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/entity/Vehicle.java
View file @
643572c6
...
...
@@ -56,10 +56,6 @@ public class Vehicle {
* 车架号
*/
private
String
vin
;
/**
* 里程数
*/
private
Integer
mileage
;
/**
* 保险公司,见常量表
...
...
@@ -98,8 +94,35 @@ public class Vehicle {
private
Integer
maintenanceMileage
;
/**
* 是否违章
* 车辆所属人-类型
*/
private
Integer
belongTo
;
/**
* 所属人 名称
*/
private
Integer
haveViolation
;
private
String
belongToName
;
/**
* 行驶证路径
*/
private
String
drivingLicensePath
;
/**
* 发动机号
*/
private
String
engineNum
;
/**
* 生产商
*/
private
String
manufacturer
;
/**
* 收车时间
*/
private
Date
receiveTime
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/entity/VehicleBookRecord.java
View file @
643572c6
...
...
@@ -160,4 +160,20 @@ public class VehicleBookRecord {
*/
private
String
retRemark
;
/**
* 提车阶段里程数
*/
private
Integer
mileageLift
;
/**
* 还车阶段里程数
*/
private
Integer
mileageRet
;
/**
* 是否违章
*/
private
Integer
haveViolation
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/interceptor/CorsInterceptor.java
View file @
643572c6
...
...
@@ -21,7 +21,6 @@ public class CorsInterceptor extends HandlerInterceptorAdapter {
response
.
addHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
addHeader
(
"Access-Control-Allow-Methods"
,
"POST, GET, OPTIONS, DELETE, PUT, HEAD"
);
response
.
addHeader
(
"Access-Control-Allow-Headers"
,
"Content-Type,authorization"
);
response
.
addHeader
(
"Access-Control-Max-Age"
,
"3600"
);
}
if
(
CorsUtils
.
isPreFlightRequest
(
request
)){
//是否跨域前option请求,使得话不执行后面拦截器
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/mapper/VehicleBookRecordMapper.java
View file @
643572c6
...
...
@@ -2,6 +2,7 @@ package com.xinxincaravan.caravan.vehicle.mapper;
import
com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord
;
import
com.xinxincaravan.caravan.vehicle.vo.QueryVehicleBookRecordVo
;
import
com.xinxincaravan.caravan.vehicle.vo.VehicleBookRecordAndTbNameVo
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
...
...
@@ -13,7 +14,7 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> {
public
List
<
VehicleBookRecord
>
getByPage4Month
(
Map
<
String
,
Object
>
params
);
public
Integer
insertHis
(
Map
<
String
,
Object
>
params
);
public
Integer
insertHis
(
VehicleBookRecordAndTbNameVo
vehicleBookRecordAndTbNameVo
);
public
Integer
del4YearMoth
(
Map
<
String
,
Object
>
params
);
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/rest/VehicleController.java
View file @
643572c6
...
...
@@ -3,6 +3,7 @@ package com.xinxincaravan.caravan.vehicle.rest;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.JWTHelper
;
...
...
@@ -20,12 +21,21 @@ import com.xinxincaravan.caravan.vehicle.entity.VehicleBookInfo;
import
com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord
;
import
com.xinxincaravan.caravan.vehicle.vo.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
@RestController
...
...
@@ -37,6 +47,8 @@ public class VehicleController extends BaseController<VehicleBiz> {
@Autowired
private
VehicleBookRecordBiz
vehicleBookRecordBiz
;
private
static
Integer
MAX_DRIVING_LICENSE_SIZE
=
10
*
1024
*
1024
;
//10M
public
static
final
DateTimeFormatter
DEFAULT_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd HH:mm:ss"
);
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
...
...
@@ -72,6 +84,27 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
}
@RequestMapping
(
value
=
"/upload/drivingLicense"
,
method
=
RequestMethod
.
POST
)
public
RestResponse
uploadDrivingLicense
(
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
String
contentType
=
file
.
getContentType
();
//图片文件类型
// String fileName = file.getOriginalFilename(); //图片名字
if
(!
contentType
.
equals
(
"image/jpeg"
)
&&
!
contentType
.
equals
(
"image/gif"
)){
return
RestResponse
.
code
(
ResCode
.
INVALID_REST_REQ_PARAM
.
getCode
());
}
if
(
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
){
return
RestResponse
.
code
(
ResCode
.
INVALID_REST_REQ_PARAM
.
getCode
());
}
return
baseBiz
.
uploadDrivingLicense
(
file
);
}
@IgnoreUserToken
@RequestMapping
(
value
=
"/download/drivingLicense"
,
method
=
RequestMethod
.
GET
)
//匹配的是href中的download请求
public
ResponseEntity
<
byte
[]>
downloadDrivingLicense
(
@RequestParam
(
"realFileRelPath"
)
String
realFileRelPath
)
throws
Exception
{
return
baseBiz
.
downloadDrivingLicense
(
realFileRelPath
);
}
@RequestMapping
(
value
=
"/bookedInfo/{vehicleId}/{yearMonth}"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
VehicleBookInfo
>
getBookedInfo
(
@PathVariable
String
vehicleId
,
@PathVariable
String
yearMonth
)
{
return
RestResponse
.
data
(
baseBiz
.
getByVehicleIdAndYearMonth
(
vehicleId
,
yearMonth
));
...
...
@@ -88,7 +121,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
* @return
*/
@RequestMapping
(
value
=
"/book/4employee"
,
method
=
RequestMethod
.
POST
)
public
RestResponse
<
Integer
>
applyVehicle
(
@RequestBody
BookVehicleVo
bookVehicleVo
){
public
RestResponse
<
Integer
>
applyVehicle
(
@RequestBody
BookVehicleVo
bookVehicleVo
)
throws
Exception
{
Integer
operatorId
=
Integer
.
parseInt
(
BaseContextHandler
.
getUserID
());
String
userName
=
BaseContextHandler
.
getName
();
return
baseBiz
.
applyVehicle4Employee
(
operatorId
,
bookVehicleVo
,
userName
);
...
...
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/AddOrUpdateVehicleVo.java
View file @
643572c6
...
...
@@ -57,10 +57,6 @@ public class AddOrUpdateVehicleVo {
* 车架号
*/
private
String
vin
;
/**
* 里程数
*/
private
Integer
mileage
;
/**
* 保险公司,见常量表
...
...
@@ -99,9 +95,32 @@ public class AddOrUpdateVehicleVo {
private
Integer
maintenanceMileage
;
/**
* 是否违章
* 车辆所属人-类型
*/
private
Integer
belongTo
;
/**
* 所属人 名称
*/
private
Integer
haveViolation
;
private
String
belongToName
;
/**
* 行驶证路径
*/
private
String
drivingLicensePath
;
/**
* 发动机号
*/
private
String
engineNum
;
/**
* 生产商
*/
private
String
manufacturer
;
/**
* 生产商
*/
private
Date
receiveTime
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/BookVehicleVo.java
View file @
643572c6
...
...
@@ -57,4 +57,20 @@ public class BookVehicleVo {
*/
Map
<
Integer
,
Integer
>
selectedAccItem
;
/**
* 提车阶段里程数
*/
private
Integer
mileageLift
;
/**
* 还车阶段里程数
*/
private
Integer
mileageRet
;
/**
* 是否违章
*/
private
Integer
haveViolation
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/BranchCompanyVo.java
View file @
643572c6
...
...
@@ -51,6 +51,18 @@ public class BranchCompanyVo {
*/
private
String
addrDetail
;
/**
* 负责人
*/
private
String
leader
;
/**
* 负责人联系方式
*/
private
String
leaderContactInfo
;
/**
* 分公司状态
*/
private
Integer
status
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/LiftVehicleVo.java
View file @
643572c6
...
...
@@ -19,4 +19,9 @@ public class LiftVehicleVo {
*/
private
String
liftRemark
;
/**
* 提车阶段里程数
*/
private
Integer
mileageLift
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/QueryVehicleBookRecordVo.java
View file @
643572c6
...
...
@@ -189,5 +189,20 @@ public class QueryVehicleBookRecordVo {
*/
Map
<
Integer
,
Integer
>
accItemAndAmount
;
/**
* 提车阶段里程数
*/
private
Integer
mileageLift
;
/**
* 还车阶段里程数
*/
private
Integer
mileageRet
;
/**
* 是否违章
*/
private
Integer
haveViolation
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/QueryVehicleVo.java
View file @
643572c6
...
...
@@ -60,10 +60,6 @@ public class QueryVehicleVo {
* 车架号
*/
private
String
vin
;
/**
* 里程数
*/
private
Integer
mileage
;
/**
* 保险公司,见常量表
...
...
@@ -102,8 +98,33 @@ public class QueryVehicleVo {
private
Integer
maintenanceMileage
;
/**
* 是否违章
* 车辆所属人-类型
*/
private
Integer
belongTo
;
/**
* 所属人 名称
*/
private
Integer
haveViolation
;
private
String
belongToName
;
/**
* 行驶证路径
*/
private
String
drivingLicensePath
;
/**
* 发动机号
*/
private
String
engineNum
;
/**
* 生产商
*/
private
String
manufacturer
;
/**
* 生产商
*/
private
Date
receiveTime
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/RetVehicleVo.java
View file @
643572c6
...
...
@@ -19,4 +19,13 @@ public class RetVehicleVo {
*/
private
String
retRemark
;
/**
* 还车阶段里程数
*/
private
Integer
mileageRet
;
/**
* 是否违章
*/
private
Integer
haveViolation
;
}
\ No newline at end of file
vehicle/src/main/java/com/xinxincaravan/caravan/vehicle/vo/VehicleBookRecordAndTbNameVo.java
0 → 100644
View file @
643572c6
package
com
.
xinxincaravan
.
caravan
.
vehicle
.
vo
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.util.Date
;
@Data
public
class
VehicleBookRecordAndTbNameVo
{
/**
* 表格名称
*/
private
String
tbName
;
/**
* 主键
*/
private
Long
id
;
/**
* 车辆id
*/
private
String
vehicle
;
/**
* 申请状态:1-申请中 2-已通过 3-已归还 4-拒绝 5-逾期归还
*/
private
Integer
status
;
/**
* 预定类型,1-用户租赁、2-分公司使用、3-维修
*/
private
Integer
bookType
;
/**
* 预定用户id
*/
private
Integer
bookUser
;
/**
* 预定用户姓名
*/
private
String
bookUserName
;
/**
* 联系信息,比如电话、联系人姓名等(json)
*/
@Column
(
name
=
"contact_info"
)
private
String
contactInfo
;
/**
* 申请开始日期
*/
private
Date
bookStartDate
;
/**
* 提车地点(经纬度)
*/
private
String
liftLocation
;
/**
* 提车地址
*/
private
String
liftAddr
;
private
String
remark
;
/**
* 目的地
*/
private
String
destination
;
/**
* 申请审核人,-1代表系统
*/
private
Integer
reviewerApply
;
/**
* 申请审核人姓名
*/
private
String
reviewerNameApply
;
/**
* 归还审核人,-1代表系统
*/
private
Integer
reviewerReturn
;
/**
* 归还审核人姓名
*/
private
String
reviewerNameReturn
;
/**
* 取消人,-1代表系统
*/
private
Integer
reviewerCancel
;
/**
* 取消人姓名
*/
private
String
reviewerNameCancel
;
/**
* 提车审核人,-1代表系统
*/
private
Integer
reviewerLift
;
/**
* 提车审核人姓名
*/
private
String
reviewerNameLift
;
/**
* 申请结束日期
*/
@Column
(
name
=
"book_end_date"
)
private
Date
bookEndDate
;
/**
* 实际开始日期
*/
private
Date
actualStartDate
;
/**
* 实际结束日期
*/
private
Date
actualEndDate
;
/**
* 提车公司
*/
private
Integer
liftCompany
;
/**
* 提车备注
*/
private
String
liftRemark
;
/**
* 还车公司
*/
private
Integer
retCompany
;
/**
* 还车备注
*/
private
String
retRemark
;
/**
* 提车阶段里程数
*/
private
Integer
mileageLift
;
/**
* 还车阶段里程数
*/
private
Integer
mileageRet
;
/**
* 是否违章
*/
private
Integer
haveViolation
;
}
\ No newline at end of file
vehicle/src/main/resources/application.yml
View file @
643572c6
...
...
@@ -43,7 +43,7 @@ spring:
#--------------------以下为redis相关配置----------------------
redis
:
database
:
2
host
:
${REDIS_HOST:10.5.52.
2
}
host
:
${REDIS_HOST:10.5.52.
3
}
port
:
${REDIS_PORT:6379}
password
:
xx2019fc
jedis
:
...
...
vehicle/src/main/resources/mapper/VehicleBookRecordMapper.xml
View file @
643572c6
...
...
@@ -22,6 +22,16 @@
<if
test=
"reviewerNameCancel != null and reviewerNameCancel !=''"
>
reviewer_name_cancel =#{reviewerNameCancel},
</if>
<if
test=
"mileageLift != null"
>
mileage_lift =#{mileageLift},
</if>
<if
test=
"mileageRet != null "
>
mileage_ret =#{mileageRet},
</if>
<if
test=
"haveViolation != null"
>
have_violation =#{haveViolation},
</if>
`status` = #{status}
where id = #{id} and `status` = #{statusCondition}
</update>
...
...
@@ -57,7 +67,15 @@
<if
test=
"liftCompany != null"
>
`lift_company` = #{liftCompany},
</if>
<if
test=
"mileageLift != null"
>
mileage_lift =#{mileageLift},
</if>
<if
test=
"mileageRet != null "
>
mileage_ret =#{mileageRet},
</if>
<if
test=
"haveViolation != null"
>
have_violation =#{haveViolation},
</if>
<choose>
<when
test=
"targetStatus == 7"
>
`actual_start_date` = now()
</when>
<when
test=
"targetStatus == 3"
>
`actual_end_date` = now()
</when>
...
...
@@ -94,6 +112,9 @@
lift_company,
lift_remark,
ret_company,
mileage_lift,
mileage_ret,
have_violation,
ret_remark
)
values(
...
...
@@ -123,6 +144,9 @@
#{liftCompany},
#{liftRemark},
#{retCompany},
#{mileageLift},
#{mileageRet},
#{haveViolation},
#{retRemark}
);
</insert>
...
...
@@ -157,6 +181,9 @@
lift_company,
lift_remark,
ret_company,
mileage_lift,
mileage_ret,
have_violation,
ret_remark
from
vehicle_book_record
...
...
@@ -198,6 +225,9 @@
vbr.lift_remark,
vbr.ret_company,
bcr.name as retCompanyName ,
vbr.mileage_lift,
vbr.mileage_ret,
vbr.have_violation,
vbr.ret_remark,
v.`code` as vehicleCode,
v.number_plate as numberPlate,
...
...
@@ -270,6 +300,9 @@
vbr.lift_company,
vbr.lift_remark,
vbr.ret_company,
vbr.mileage_lift,
vbr.mileage_ret,
vbr.have_violation,
vbr.ret_remark
from ${tbName} vbr
where id = #{id}
...
...
@@ -309,6 +342,9 @@
`ret_remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '还车备注',
`reviewer_lift` int(10) NULL DEFAULT NULL COMMENT '提车审核人',
`reviewer_name_lift` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提车审核人姓名',
`mileage_lift` int(10) NULL DEFAULT NULL COMMENT '提车里程数',
`mileage_ret` int(10) NULL DEFAULT NULL COMMENT '还车里程数',
`have_violation` tinyint(4) NULL DEFAULT NULL COMMENT '是否违章',
PRIMARY KEY (`id`) USING BTREE,
INDEX `i_vehicle`(`vehicle`) USING BTREE,
INDEX `i_book_user`(`book_user`) USING BTREE,
...
...
vehicle/src/main/resources/mapper/VehicleMapper.xml
View file @
643572c6
...
...
@@ -22,7 +22,6 @@
v.remark,
v.create_time,
v.vin,
v.mileage,
v.insurance_company,
v.insurance_no,
v.insurance_start_date,
...
...
@@ -30,7 +29,12 @@
v.annual_verification_date,
v.maintenance_date,
v.maintenance_mileage,
v.have_violation,
v.belong_to,
v.belong_to_name,
v.driving_license_path,
v.engine_num,
v.manufacturer,
v.receive_time,
v.update_time
<if
test=
" yearMonthAndParam !=null "
>
,vbi.booked_date
...
...
@@ -43,9 +47,6 @@
left join branch_company bc on v.`subordinate_branch` = bc.id
where
1=1
<if
test=
"haveViolation !=null"
>
and v.have_violation = #{haveViolation}
</if>
<if
test=
"mRangeDateEnd !=null"
>
and v.maintenance_date
<
= #{mRangeDateEnd}
</if>
...
...
@@ -67,12 +68,6 @@
<if
test=
"insuranceCompany !=null"
>
and v.insurance_company = #{insuranceCompany}
</if>
<if
test=
"mileageRangeEnd !=null"
>
and v.mileage
<
= #{mileageRangeEnd}
</if>
<if
test=
"mileageRangeStart !=null"
>
and v.mileage
>
= #{mileageRangeStart}
</if>
<if
test=
"vin !=null and vin != ''"
>
and v.vin = #{vin}
</if>
...
...
@@ -110,14 +105,7 @@
select
v.`id`,
v.`code`,
v.`status`,
v.number_plate,
v.brand,
v.subordinate_branch,
v.use_type,
v.remark,
v.create_time,
v.update_time
v.number_plate
from vehicle v
where
`code` = #{code}
...
...
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