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 7661aeaa
authored
Aug 18, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车型管理
1 parent
bdb20ebd
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
388 additions
and
12 deletions
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
src/main/java/cn/com/glsx/admin/modules/entity/TenantVehicleType.java
src/main/java/cn/com/glsx/admin/modules/entity/TrialDriveVehicle.java
src/main/java/cn/com/glsx/admin/modules/mapper/TenantVehicleTypeMapper.java
src/main/java/cn/com/glsx/admin/modules/mapper/TrialDriveVehicleMapper.java
src/main/java/cn/com/glsx/admin/modules/model/TenantTypesDTO.java
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleTypesBO.java
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
src/main/resources/mapper/TenantVehicleTypeMapper.xml
src/main/resources/mapper/TrialDriveVehicleMapper.xml
src/test/java/cn/com/glsx/admin/modules/service/DubboServiceTest.java
src/test/java/cn/com/glsx/admin/modules/service/VehicleServiceTest.java
src/main/java/cn/com/glsx/admin/modules/controller/VehicleController.java
View file @
7661aea
...
@@ -145,7 +145,7 @@ public class VehicleController {
...
@@ -145,7 +145,7 @@ public class VehicleController {
}
}
@PostMapping
(
value
=
"/drivevehicle/syncVehicleInfo"
,
consumes
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@PostMapping
(
value
=
"/drivevehicle/syncVehicleInfo"
,
consumes
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@SysLog
(
value
=
"同步车辆信息"
,
action
=
OperateType
.
API
,
saveLog
=
false
)
@SysLog
(
value
=
"同步车辆信息"
,
action
=
OperateType
.
API
,
saveLog
=
false
)
@ApiOperation
(
value
=
"同步车辆信息"
)
@ApiOperation
(
value
=
"同步车辆信息"
)
public
R
syncVehicleDeviceInfo
(
@RequestBody
@Validated
(
ValidateGroups
.
Insert
.
class
)
SyncVehicleBo
vehicleBo
)
{
public
R
syncVehicleDeviceInfo
(
@RequestBody
@Validated
(
ValidateGroups
.
Insert
.
class
)
SyncVehicleBo
vehicleBo
)
{
try
{
try
{
...
@@ -204,4 +204,19 @@ public class VehicleController {
...
@@ -204,4 +204,19 @@ public class VehicleController {
return
R
.
ok
().
data
(
carTypeList
);
return
R
.
ok
().
data
(
carTypeList
);
}
}
@SysLog
(
value
=
"保存车型库"
,
action
=
OperateType
.
ADD
)
@ApiOperation
(
value
=
"保存车型库"
)
@PostMapping
(
"/savetypes"
)
public
R
<
List
<
Cartype
>>
saveVehicleTypes
(
@RequestBody
VehicleTypesBO
typesBO
)
{
vehicleService
.
saveVehicleTypes
(
typesBO
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"获取组织配置的车型库"
)
@GetMapping
(
"/gettenanttypes"
)
public
R
<
TenantTypesDTO
>
getTenantTypes
(
@RequestParam
Long
tenantId
)
{
TenantTypesDTO
typesDTO
=
vehicleService
.
getTenantTypes
(
tenantId
);
return
R
.
ok
().
data
(
typesDTO
);
}
}
}
src/main/java/cn/com/glsx/admin/modules/entity/TenantVehicleType.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
entity
;
import
com.glsx.plat.mybatis.base.BaseEntity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
@Data
@Table
(
name
=
"t_tenant_vehicle_type"
)
public
class
TenantVehicleType
extends
BaseEntity
{
/**
* 租户id
*/
@Column
(
name
=
"tenant_id"
)
private
Long
tenantId
;
/**
* 车型库名称
*/
private
String
name
;
/**
* 车辆品牌id
*/
@Column
(
name
=
"brand_id"
)
private
Long
brandId
;
/**
* 车辆品牌
*/
@Column
(
name
=
"brand_name"
)
private
String
brandName
;
/**
* 车辆系别id
*/
@Column
(
name
=
"series_id"
)
private
Long
seriesId
;
/**
* 车辆系别
*/
@Column
(
name
=
"series_name"
)
private
String
seriesName
;
/**
* 车辆类型id
*/
@Column
(
name
=
"type_id"
)
private
Long
typeId
;
/**
* 车辆类型
*/
@Column
(
name
=
"type_name"
)
private
String
typeName
;
/**
* 状态(1=启用 2=禁用)
*/
@Column
(
name
=
"enable_status"
)
private
Integer
enableStatus
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/entity/TrialDriveVehicle.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
entity
;
import
com.glsx.plat.mybatis.base.BaseEntity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
@Data
@Table
(
name
=
"t_trial_drive_vehicle"
)
public
class
TrialDriveVehicle
extends
BaseEntity
{
/**
* 车辆id
*/
@Column
(
name
=
"vehicle_id"
)
private
Long
vehicleId
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/mapper/TenantVehicleTypeMapper.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
mapper
;
import
cn.com.glsx.admin.modules.entity.TenantVehicleType
;
import
cn.com.glsx.admin.modules.model.TenantTypesDTO
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
TenantVehicleTypeMapper
extends
CommonBaseMapper
<
TenantVehicleType
>
{
TenantTypesDTO
selectByTenantId
(
Long
tenantId
);
/**
* 逻辑删除
*
* @param tenantId
* @return
*/
int
logicDeleteByTenantId
(
@Param
(
"tenantId"
)
Long
tenantId
);
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/mapper/TrialDriveVehicleMapper.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
mapper
;
import
cn.com.glsx.admin.modules.entity.TrialDriveVehicle
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
TrialDriveVehicleMapper
extends
CommonBaseMapper
<
TrialDriveVehicle
>
{
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/admin/modules/model/TenantTypesDTO.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
TenantTypesDTO
{
private
Long
tenantId
;
private
String
name
;
/**
* 启用状态:0关闭;1开启
*/
private
Integer
enableStatus
;
@JsonIgnore
private
String
types
;
private
List
<
Long
>
typeIds
;
}
src/main/java/cn/com/glsx/admin/modules/model/param/VehicleTypesBO.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
param
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
@Data
public
class
VehicleTypesBO
{
@NotNull
(
message
=
"组织ID不能为空"
)
private
Long
tenantId
;
@NotBlank
(
message
=
"车型库名称不能为空"
)
private
String
name
;
/**
* 启用状态:0关闭;1开启
*/
private
Integer
enableStatus
;
private
List
<
Long
>
typeIds
;
}
src/main/java/cn/com/glsx/admin/modules/service/VehicleService.java
View file @
7661aea
...
@@ -5,10 +5,13 @@ import cn.com.glsx.admin.common.constants.ConstantsDevice;
...
@@ -5,10 +5,13 @@ import cn.com.glsx.admin.common.constants.ConstantsDevice;
import
cn.com.glsx.admin.common.constants.ConstantsVehicle
;
import
cn.com.glsx.admin.common.constants.ConstantsVehicle
;
import
cn.com.glsx.admin.common.enums.ResultEnum
;
import
cn.com.glsx.admin.common.enums.ResultEnum
;
import
cn.com.glsx.admin.common.exception.AdminException
;
import
cn.com.glsx.admin.common.exception.AdminException
;
import
cn.com.glsx.admin.modules.entity.TenantVehicleType
;
import
cn.com.glsx.admin.modules.entity.TransAccountData
;
import
cn.com.glsx.admin.modules.entity.TransAccountData
;
import
cn.com.glsx.admin.modules.entity.Vehicle
;
import
cn.com.glsx.admin.modules.entity.Vehicle
;
import
cn.com.glsx.admin.modules.entity.VehicleDevice
;
import
cn.com.glsx.admin.modules.entity.VehicleDevice
;
import
cn.com.glsx.admin.modules.mapper.TenantVehicleTypeMapper
;
import
cn.com.glsx.admin.modules.mapper.VehicleMapper
;
import
cn.com.glsx.admin.modules.mapper.VehicleMapper
;
import
cn.com.glsx.admin.modules.model.TenantTypesDTO
;
import
cn.com.glsx.admin.modules.model.TrialDriveVehicleEditDTO
;
import
cn.com.glsx.admin.modules.model.TrialDriveVehicleEditDTO
;
import
cn.com.glsx.admin.modules.model.TrialDriveVehiclePageDTO
;
import
cn.com.glsx.admin.modules.model.TrialDriveVehiclePageDTO
;
import
cn.com.glsx.admin.modules.model.VehicleLinkSnsDTO
;
import
cn.com.glsx.admin.modules.model.VehicleLinkSnsDTO
;
...
@@ -32,21 +35,21 @@ import com.glsx.biz.common.base.service.CarseriesService;
...
@@ -32,21 +35,21 @@ import com.glsx.biz.common.base.service.CarseriesService;
import
com.glsx.biz.common.base.service.CartypeService
;
import
com.glsx.biz.common.base.service.CartypeService
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.ConvertUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @Desc:试驾车辆service
* @Desc:试驾车辆service
...
@@ -90,6 +93,9 @@ public class VehicleService {
...
@@ -90,6 +93,9 @@ public class VehicleService {
@DubboReference
(
version
=
"2.2.0"
)
@DubboReference
(
version
=
"2.2.0"
)
private
CartypeService
cartypeService
;
private
CartypeService
cartypeService
;
@Autowired
private
TenantVehicleTypeMapper
tenantVehicleTypeMapper
;
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
);
...
@@ -402,7 +408,6 @@ public class VehicleService {
...
@@ -402,7 +408,6 @@ public class VehicleService {
fenceService
.
syncUsersFencesSns
(
userIds
);
fenceService
.
syncUsersFencesSns
(
userIds
);
}
}
/**
/**
* 同步设备信息
* 同步设备信息
*
*
...
@@ -465,7 +470,6 @@ public class VehicleService {
...
@@ -465,7 +470,6 @@ public class VehicleService {
}
}
/**
/**
* 查找创建人id
* 查找创建人id
*
*
...
@@ -538,7 +542,6 @@ public class VehicleService {
...
@@ -538,7 +542,6 @@ public class VehicleService {
return
vehicle
;
return
vehicle
;
}
}
/**
/**
* 检查该设备是否绑定 如果绑定 则解除绑定 重新绑定新车辆
* 检查该设备是否绑定 如果绑定 则解除绑定 重新绑定新车辆
*
*
...
@@ -693,16 +696,61 @@ public class VehicleService {
...
@@ -693,16 +696,61 @@ public class VehicleService {
return
carbrandService
.
getParentCarbrandList
();
return
carbrandService
.
getParentCarbrandList
();
}
}
@Cacheable
(
value
=
"carbrands"
,
key
=
"#brandId"
)
public
List
<
Carbrand
>
getSubBrandsByBrandId
(
Long
brandId
)
{
public
List
<
Carbrand
>
getSubBrandsByBrandId
(
Long
brandId
)
{
return
carbrandService
.
listSubCarbrandByParentId
(
Math
.
toIntExact
(
brandId
));
return
carbrandService
.
listSubCarbrandByParentId
(
Math
.
toIntExact
(
brandId
));
}
}
@Cacheable
(
value
=
"carseries"
,
key
=
"#brandId"
)
public
List
<
Carseries
>
getSeriesByBrandId
(
Long
brandId
)
{
public
List
<
Carseries
>
getSeriesByBrandId
(
Long
brandId
)
{
return
carseriesService
.
getByCarbrandId
(
Math
.
toIntExact
(
brandId
));
return
carseriesService
.
getByCarbrandId
(
Math
.
toIntExact
(
brandId
));
}
}
@Cacheable
(
value
=
"cartypes"
,
key
=
"#seriesId"
)
public
List
<
Cartype
>
getTypesBySeriesId
(
Long
seriesId
)
{
public
List
<
Cartype
>
getTypesBySeriesId
(
Long
seriesId
)
{
return
cartypeService
.
getBySeiesId
(
Math
.
toIntExact
(
seriesId
));
return
cartypeService
.
getBySeiesId
(
Math
.
toIntExact
(
seriesId
));
}
}
@Cacheable
(
value
=
"cartype"
,
key
=
"#typeId"
)
public
Cartype
getByTypeId
(
Long
typeId
)
{
return
cartypeService
.
getByCarTypeId
(
Math
.
toIntExact
(
typeId
));
}
public
void
saveVehicleTypes
(
VehicleTypesBO
typesBO
)
{
List
<
TenantVehicleType
>
tvTypeList
=
Lists
.
newArrayListWithCapacity
(
typesBO
.
getTypeIds
().
size
());
typesBO
.
getTypeIds
().
forEach
(
tId
->
{
Cartype
carType
=
this
.
getByTypeId
(
tId
);
if
(
carType
!=
null
)
{
TenantVehicleType
tvType
=
new
TenantVehicleType
();
tvType
.
setTenantId
(
typesBO
.
getTenantId
());
tvType
.
setName
(
typesBO
.
getName
());
tvType
.
setBrandId
(
Long
.
valueOf
(
carType
.
getCarBrandId
()));
tvType
.
setBrandName
(
carType
.
getCarBrandName
());
tvType
.
setSeriesId
(
Long
.
valueOf
(
carType
.
getSeriesId
()));
tvType
.
setSeriesName
(
carType
.
getCarSeriesName
());
tvType
.
setTypeId
(
Long
.
valueOf
(
carType
.
getCarTypeId
()));
tvType
.
setTypeName
(
carType
.
getName
());
tvType
.
setEnableStatus
(
typesBO
.
getEnableStatus
());
tvTypeList
.
add
(
tvType
);
}
});
if
(
CollectionUtils
.
isNotEmpty
(
tvTypeList
))
{
tenantVehicleTypeMapper
.
logicDeleteByTenantId
(
typesBO
.
getTenantId
());
tenantVehicleTypeMapper
.
insertList
(
tvTypeList
);
}
}
public
TenantTypesDTO
getTenantTypes
(
Long
tenantId
)
{
TenantTypesDTO
typesDTO
=
tenantVehicleTypeMapper
.
selectByTenantId
(
tenantId
);
if
(
typesDTO
!=
null
)
{
String
[]
typeStrs
=
typesDTO
.
getTypes
().
split
(
","
);
Long
[]
types
=
(
Long
[])
ConvertUtils
.
convert
(
typeStrs
,
Long
.
class
);
typesDTO
.
setTypeIds
(
Arrays
.
asList
(
types
));
}
return
typesDTO
;
}
}
}
src/main/resources/mapper/TenantVehicleTypeMapper.xml
0 → 100644
View file @
7661aea
<?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=
"cn.com.glsx.admin.modules.mapper.TenantVehicleTypeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.admin.modules.entity.TenantVehicleType"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"tenant_id"
jdbcType=
"INTEGER"
property=
"tenantId"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"brand_id"
jdbcType=
"INTEGER"
property=
"brandId"
/>
<result
column=
"brand_name"
jdbcType=
"VARCHAR"
property=
"brandName"
/>
<result
column=
"series_id"
jdbcType=
"INTEGER"
property=
"seriesId"
/>
<result
column=
"series_name"
jdbcType=
"VARCHAR"
property=
"seriesName"
/>
<result
column=
"type_id"
jdbcType=
"INTEGER"
property=
"typeId"
/>
<result
column=
"type_name"
jdbcType=
"VARCHAR"
property=
"typeName"
/>
<result
column=
"enable_status"
jdbcType=
"TINYINT"
property=
"enableStatus"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
<result
column=
"updated_date"
jdbcType=
"TIMESTAMP"
property=
"updatedDate"
/>
<result
column=
"updated_by"
jdbcType=
"INTEGER"
property=
"updatedBy"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
-->
id, tenant_id, `name`, brand_id, brand_name, series_id, series_name, type_id, type_name,
enable_status, del_flag, created_date, created_by, updated_date, updated_by
</sql>
<select
id=
"selectByTenantId"
resultType=
"cn.com.glsx.admin.modules.model.TenantTypesDTO"
>
select tenant_id tenantId, name, group_concat(type_id) types, enable_status enableStatus
from t_tenant_vehicle_type
where del_flag = 0
and tenant_id = #{tenantId}
group by tenant_id, name
</select>
<update
id=
"logicDeleteByTenantId"
>
update t_tenant_vehicle_type
set del_flag = -1
where tenant_id = #{tenantId}
</update>
</mapper>
\ No newline at end of file
\ No newline at end of file
src/main/resources/mapper/TrialDriveVehicleMapper.xml
0 → 100644
View file @
7661aea
<?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=
"cn.com.glsx.admin.modules.mapper.TrialDriveVehicleMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.admin.modules.entity.TrialDriveVehicle"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"vehicle_id"
jdbcType=
"INTEGER"
property=
"vehicleId"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_by"
jdbcType=
"INTEGER"
property=
"createdBy"
/>
<result
column=
"updated_date"
jdbcType=
"TIMESTAMP"
property=
"updatedDate"
/>
<result
column=
"updated_by"
jdbcType=
"INTEGER"
property=
"updatedBy"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
-->
id, vehicle_id, del_flag, created_date, created_by, updated_date, updated_by
</sql>
</mapper>
\ No newline at end of file
\ No newline at end of file
src/test/java/cn/com/glsx/admin/modules/service/DubboServiceTest.java
0 → 100644
View file @
7661aea
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
import
cn.com.glsx.Application
;
import
cn.hutool.json.JSONUtil
;
import
com.glsx.biz.common.base.entity.CarBrandSelected
;
import
com.glsx.biz.common.base.entity.Carbrand
;
import
com.glsx.biz.common.base.entity.Carseries
;
import
com.glsx.biz.common.base.entity.Cartype
;
import
com.glsx.biz.common.base.service.CarbrandService
;
import
com.glsx.biz.common.base.service.CarseriesService
;
import
com.glsx.biz.common.base.service.CartypeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.List
;
@Slf4j
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
DubboServiceTest
{
@DubboReference
(
version
=
"2.2.0"
)
private
CarbrandService
carbrandService
;
@DubboReference
(
version
=
"2.2.0"
)
private
CarseriesService
carseriesService
;
@DubboReference
(
version
=
"2.2.0"
)
private
CartypeService
cartypeService
;
@Test
public
void
getAllCarbrand
()
{
// List<Carbrand> carbrandList = carbrandService.getParentCarbrandList();
// System.out.println(JSONUtil.toJsonStr(carbrandList));
// List<Carbrand> carbrandList2 = carbrandService.listSubCarbrandByParentId(2165);
// System.out.println(JSONUtil.toJsonStr(carbrandList2));
List
<
CarBrandSelected
>
carbrandList3
=
carbrandService
.
getCarInfoCompleteForSelected
();
System
.
out
.
println
(
JSONUtil
.
toJsonStr
(
carbrandList3
));
// List<Carbrand> carbrandList22 = carbrandService.findByBraLetter("东风本田");
// List<Carbrand> carbrandList23 = carbrandService.findByName("东风本田");
// System.out.println(JSONUtil.toJsonStr(carbrandList22));
// System.out.println(JSONUtil.toJsonStr(carbrandList23));
}
@Test
public
void
getCarseries
()
{
List
<
Carseries
>
carseriesList
=
carseriesService
.
getByCarbrandId
(
2167
);
System
.
out
.
println
(
JSONUtil
.
toJsonStr
(
carseriesList
));
}
@Test
public
void
getCartype
()
{
// List<Cartype> cartypeList = cartypeService.getBySeiesId(1145341);
// System.out.println(JSONUtil.toJsonStr(cartypeList));
Cartype
cartype1
=
cartypeService
.
getByCarTypeId
(
Math
.
toIntExact
(
43083L
));
System
.
out
.
println
(
111
);
}
}
src/test/java/cn/com/glsx/admin/modules/service/VehicleServiceTest.java
View file @
7661aea
...
@@ -15,8 +15,8 @@ import cn.com.glsx.publiccenter.api.dto.response.SysDictDataResponse;
...
@@ -15,8 +15,8 @@ import cn.com.glsx.publiccenter.api.dto.response.SysDictDataResponse;
import
cn.com.glsx.publiccenter.api.feign.SysDictDataService
;
import
cn.com.glsx.publiccenter.api.feign.SysDictDataService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -43,6 +43,7 @@ public class VehicleServiceTest {
...
@@ -43,6 +43,7 @@ public class VehicleServiceTest {
@Autowired
@Autowired
private
SysDictDataService
dictDataService
;
private
SysDictDataService
dictDataService
;
@Before
@Before
public
void
runBeforeTestMethod
()
{
public
void
runBeforeTestMethod
()
{
SyntheticUser
user
=
new
SyntheticUser
();
SyntheticUser
user
=
new
SyntheticUser
();
...
@@ -52,8 +53,8 @@ public class VehicleServiceTest {
...
@@ -52,8 +53,8 @@ public class VehicleServiceTest {
Department
department
=
new
Department
();
Department
department
=
new
Department
();
department
.
setDeptId
(
182L
);
department
.
setDeptId
(
182L
);
user
.
setDepartment
(
department
);
user
.
setDepartment
(
department
);
List
<
Role
>
roleList
=
new
ArrayList
<>();
List
<
Role
>
roleList
=
new
ArrayList
<>();
Role
role
=
new
Role
();
Role
role
=
new
Role
();
role
.
setRoleId
(
38L
);
role
.
setRoleId
(
38L
);
roleList
.
add
(
role
);
roleList
.
add
(
role
);
user
.
setRoles
(
roleList
);
user
.
setRoles
(
roleList
);
...
@@ -132,7 +133,7 @@ public class VehicleServiceTest {
...
@@ -132,7 +133,7 @@ public class VehicleServiceTest {
}
}
@Test
@Test
public
void
deleteDriveVehicleAndUnBindTest
(){
public
void
deleteDriveVehicleAndUnBindTest
()
{
vehicleService
.
deleteDriveVehicleAndUnBind
(
"140"
);
vehicleService
.
deleteDriveVehicleAndUnBind
(
"140"
);
}
}
...
@@ -206,4 +207,17 @@ public class VehicleServiceTest {
...
@@ -206,4 +207,17 @@ public class VehicleServiceTest {
vehicleService
.
syncVehicleDeviceLinkFence
(
bo
);
vehicleService
.
syncVehicleDeviceLinkFence
(
bo
);
}
}
@Test
public
void
testSaveVehicleTypes
()
{
VehicleTypesBO
typesBO
=
new
VehicleTypesBO
();
typesBO
.
setTenantId
(
37L
);
typesBO
.
setName
(
"广本车型库"
);
typesBO
.
setEnableStatus
(
1
);
List
<
Long
>
typeIdList
=
Lists
.
newArrayList
();
typeIdList
.
add
(
1145L
);
typeIdList
.
add
(
43084L
);
typesBO
.
setTypeIds
(
typeIdList
);
vehicleService
.
saveVehicleTypes
(
typesBO
);
}
}
}
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