Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8592ce24
authored
Sep 13, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
eb109395
f48b055e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
38 deletions
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/test/java/cn/com/glsx/admin/modules/service/VehicleServiceTest.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
8592ce2
...
@@ -49,6 +49,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -49,6 +49,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StopWatch
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -146,6 +147,40 @@ public class VehicleService {
...
@@ -146,6 +147,40 @@ public class VehicleService {
return
selected
;
return
selected
;
}
}
private
static
String
transWeekFrequency
(
String
week
,
String
weekTimer
)
{
StringBuilder
sb
=
new
StringBuilder
(
weekTimer
+
"/星期"
);
for
(
int
i
=
0
;
i
<
week
.
length
();
i
++)
{
char
c
=
week
.
charAt
(
i
);
switch
(
c
)
{
case
'1'
:
sb
.
append
(
"一、"
);
break
;
case
'2'
:
sb
.
append
(
"二、"
);
break
;
case
'3'
:
sb
.
append
(
"三、"
);
break
;
case
'4'
:
sb
.
append
(
"四、"
);
break
;
case
'5'
:
sb
.
append
(
"五、"
);
break
;
case
'6'
:
sb
.
append
(
"六、"
);
break
;
case
'7'
:
sb
.
append
(
"七、"
);
break
;
default
:
break
;
}
}
String
str
=
sb
.
toString
();
return
str
.
substring
(
0
,
str
.
length
()
-
1
);
}
public
PageInfo
<
TrialDriveVehiclePageDTO
>
searchTrialDrive
(
VehicleManageSearch
search
)
{
public
PageInfo
<
TrialDriveVehiclePageDTO
>
searchTrialDrive
(
VehicleManageSearch
search
)
{
PageHelper
.
startPage
(
search
.
getPageNumber
(),
search
.
getPageSize
());
PageHelper
.
startPage
(
search
.
getPageNumber
(),
search
.
getPageSize
());
List
<
TrialDriveVehiclePageDTO
>
listDriveVehicle
=
vehicleMapper
.
searchTrialDrive
(
search
);
List
<
TrialDriveVehiclePageDTO
>
listDriveVehicle
=
vehicleMapper
.
searchTrialDrive
(
search
);
...
@@ -826,7 +861,7 @@ public class VehicleService {
...
@@ -826,7 +861,7 @@ public class VehicleService {
}
}
@Cacheable
(
value
=
"carbrand"
,
key
=
"#brandId"
)
@Cacheable
(
value
=
"carbrand"
,
key
=
"#brandId"
)
public
Carbrand
getByBrandId
(
Integer
brandId
)
{
public
Carbrand
getBy
Parent
BrandId
(
Integer
brandId
)
{
return
carbrandService
.
getParentBrandByBrandId
(
brandId
);
return
carbrandService
.
getParentBrandByBrandId
(
brandId
);
}
}
...
@@ -836,22 +871,32 @@ public class VehicleService {
...
@@ -836,22 +871,32 @@ public class VehicleService {
}
}
public
void
saveVehicleTypes
(
VehicleTypesBO
typesBO
,
Long
userId
)
{
public
void
saveVehicleTypes
(
VehicleTypesBO
typesBO
,
Long
userId
)
{
StopWatch
sw
=
new
StopWatch
();
Date
now
=
new
Date
();
Date
now
=
new
Date
();
List
<
Carbrand
>
carBrandList
=
this
.
getAllBrandList
();
Map
<
Integer
,
Carbrand
>
carBrandMap
=
carBrandList
.
stream
().
collect
(
Collectors
.
toMap
(
Carbrand:
:
getBid
,
pd
->
pd
));
List
<
TenantVehicleType
>
tvTypeList
=
Lists
.
newArrayListWithCapacity
(
typesBO
.
getTypeIds
().
size
());
List
<
TenantVehicleType
>
tvTypeList
=
Lists
.
newArrayListWithCapacity
(
typesBO
.
getTypeIds
().
size
());
sw
.
start
(
"task1"
);
log
.
info
(
"本次处理 {} 车型{}条"
,
typesBO
.
getTenantName
(),
typesBO
.
getTypeIds
().
size
());
typesBO
.
getTypeIds
().
forEach
(
tId
->
{
typesBO
.
getTypeIds
().
forEach
(
tId
->
{
Cartype
carType
=
this
.
getByTypeId
(
tId
);
Cartype
carType
=
this
.
getByTypeId
(
tId
);
if
(
carType
!=
null
)
{
if
(
carType
!=
null
)
{
Carbrand
carBrand
=
this
.
getByBrandId
(
carType
.
getCarBrandId
());
//
Carbrand carBrand = this.getByBrandId(carType.getCarBrandId());
TenantVehicleType
tvType
=
new
TenantVehicleType
();
TenantVehicleType
tvType
=
new
TenantVehicleType
();
tvType
.
setTenantId
(
typesBO
.
getTenantId
());
tvType
.
setTenantId
(
typesBO
.
getTenantId
());
tvType
.
setTenantName
(
typesBO
.
getTenantName
());
tvType
.
setTenantName
(
typesBO
.
getTenantName
());
tvType
.
setName
(
typesBO
.
getName
());
tvType
.
setName
(
typesBO
.
getName
());
tvType
.
setBrandId
(
carType
.
getCarBrandPId
());
Carbrand
carBrand
=
carBrandMap
.
get
(
carType
.
getCarBrandPId
());
if
(
carBrand
!=
null
)
{
if
(
carBrand
!=
null
)
{
tvType
.
setBrandId
(
carBrand
.
getBid
());
tvType
.
setBrandName
(
carBrand
.
getBrand
());
tvType
.
setBrandName
(
carBrand
.
getBrand
());
}
}
tvType
.
setSubBrandId
(
carType
.
getCarBrandId
());
tvType
.
setSubBrandId
(
carType
.
getCarBrandId
());
...
@@ -866,10 +911,16 @@ public class VehicleService {
...
@@ -866,10 +911,16 @@ public class VehicleService {
tvTypeList
.
add
(
tvType
);
tvTypeList
.
add
(
tvType
);
}
}
});
});
sw
.
stop
();
log
.
info
(
"{} 耗时:{} s"
,
sw
.
getLastTaskName
(),
sw
.
getLastTaskTimeMillis
());
//redisUtils.set("TenantVehicleType" + typesBO.getTenantId(), tvTypeList);
//redisUtils.set("TenantVehicleType" + typesBO.getTenantId(), tvTypeList);
sw
.
start
(
"task2"
);
syncData2Db
(
typesBO
.
getTenantId
(),
tvTypeList
);
syncData2Db
(
typesBO
.
getTenantId
(),
tvTypeList
);
sw
.
stop
();
log
.
info
(
sw
.
prettyPrint
());
log
.
info
(
"总耗时:{} s"
,
sw
.
getTotalTimeSeconds
());
}
}
//@Async
//@Async
...
@@ -1453,40 +1504,6 @@ public class VehicleService {
...
@@ -1453,40 +1504,6 @@ public class VehicleService {
return
list
;
return
list
;
}
}
private
static
String
transWeekFrequency
(
String
week
,
String
weekTimer
)
{
StringBuilder
sb
=
new
StringBuilder
(
weekTimer
+
"/星期"
);
for
(
int
i
=
0
;
i
<
week
.
length
();
i
++)
{
char
c
=
week
.
charAt
(
i
);
switch
(
c
)
{
case
'1'
:
sb
.
append
(
"一、"
);
break
;
case
'2'
:
sb
.
append
(
"二、"
);
break
;
case
'3'
:
sb
.
append
(
"三、"
);
break
;
case
'4'
:
sb
.
append
(
"四、"
);
break
;
case
'5'
:
sb
.
append
(
"五、"
);
break
;
case
'6'
:
sb
.
append
(
"六、"
);
break
;
case
'7'
:
sb
.
append
(
"七、"
);
break
;
default
:
break
;
}
}
String
str
=
sb
.
toString
();
return
str
.
substring
(
0
,
str
.
length
()
-
1
);
}
/**
/**
* 删除车辆信息
* 删除车辆信息
*
*
...
...
src/test/java/cn/com/glsx/admin/modules/service/VehicleServiceTest.java
View file @
8592ce2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment