Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
2c921e4b
Commit
2c921e4b
authored
Jun 09, 2021
by
付培阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电梯信息接口修改
parent
5e09df1f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
115 deletions
+128
-115
ElevatorVo.java
...a/com/yeejoin/amos/boot/module/tzs/api/vo/ElevatorVo.java
+16
-0
ElevatorController.java
...os/boot/module/tzs/biz/controller/ElevatorController.java
+21
-13
MaintenanceUnitController.java
.../module/tzs/biz/controller/MaintenanceUnitController.java
+22
-15
UseUnitController.java
...mos/boot/module/tzs/biz/controller/UseUnitController.java
+32
-23
BeanDtoVoUtils.java
...eejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
+37
-64
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/ElevatorVo.java
View file @
2c921e4b
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.vo;
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.vo;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -193,7 +194,22 @@ public class ElevatorVo extends BaseEntity {
...
@@ -193,7 +194,22 @@ public class ElevatorVo extends BaseEntity {
@ApiModelProperty
(
value
=
"设备图片"
)
@ApiModelProperty
(
value
=
"设备图片"
)
private
String
photos
;
private
String
photos
;
@ApiModelProperty
(
value
=
"设备图片"
)
private
List
<
Img
>
img
;
@ApiModelProperty
(
value
=
"原始表id(来自历史数据库)"
)
@ApiModelProperty
(
value
=
"原始表id(来自历史数据库)"
)
private
String
originalId
;
private
String
originalId
;
@Data
@EqualsAndHashCode
()
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"Img"
,
description
=
"Img"
)
public
static
class
Img
{
private
String
url
;
public
Img
(
String
url
)
{
this
.
url
=
url
;
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/ElevatorController.java
View file @
2c921e4b
...
@@ -24,9 +24,10 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
...
@@ -24,9 +24,10 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
/**
/**
* 电梯Api
* 电梯Api
...
@@ -53,9 +54,10 @@ public class ElevatorController extends BaseController {
...
@@ -53,9 +54,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增电梯"
,
notes
=
"新增电梯"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增电梯"
,
notes
=
"新增电梯"
)
public
boolean
saveElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
public
ResponseModel
<
Boolean
>
saveElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
return
iElevatorService
.
save
(
elevator
);
boolean
save
=
iElevatorService
.
save
(
elevator
);
return
ResponseHelper
.
buildResponse
(
save
);
}
}
/**
/**
...
@@ -67,8 +69,9 @@ public class ElevatorController extends BaseController {
...
@@ -67,8 +69,9 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
return
iElevatorService
.
removeById
(
id
);
boolean
remove
=
iElevatorService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
}
/**
/**
...
@@ -80,9 +83,10 @@ public class ElevatorController extends BaseController {
...
@@ -80,9 +83,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改电梯"
,
notes
=
"修改电梯"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改电梯"
,
notes
=
"修改电梯"
)
public
boolean
updateByIdElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
public
ResponseModel
<
Boolean
>
updateByIdElevator
(
@RequestBody
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
return
iElevatorService
.
updateById
(
elevator
);
boolean
update
=
iElevatorService
.
updateById
(
elevator
);
return
ResponseHelper
.
buildResponse
(
update
);
}
}
...
@@ -95,9 +99,10 @@ public class ElevatorController extends BaseController {
...
@@ -95,9 +99,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ElevatorVo
selectById
(
@PathVariable
Long
id
)
{
public
ResponseModel
<
ElevatorVo
>
selectById
(
@PathVariable
Long
id
)
{
Elevator
elevator
=
iElevatorService
.
getById
(
id
);
Elevator
elevator
=
iElevatorService
.
getById
(
id
);
return
BeanDtoVoUtils
.
convertElevatorEntityToVo
(
elevator
);
ElevatorVo
elevatorVo
=
BeanDtoVoUtils
.
convertElevatorToVo
(
elevator
);
return
ResponseHelper
.
buildResponse
(
elevatorVo
);
}
}
/**
/**
...
@@ -111,7 +116,7 @@ public class ElevatorController extends BaseController {
...
@@ -111,7 +116,7 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
ElevatorVo
>
listPage
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
public
ResponseModel
<
IPage
<
ElevatorVo
>
>
listPage
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Page
<
Elevator
>
pageBean
;
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
...
@@ -148,7 +153,8 @@ public class ElevatorController extends BaseController {
...
@@ -148,7 +153,8 @@ public class ElevatorController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
}
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
BeanDtoVoUtils
.
elevatorIPageVo
(
page
);
IPage
<
ElevatorVo
>
elevatorVoIPage
=
BeanDtoVoUtils
.
elevatorIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
elevatorVoIPage
);
}
}
/**
/**
...
@@ -162,7 +168,8 @@ public class ElevatorController extends BaseController {
...
@@ -162,7 +168,8 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_elevator_list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/query_elevator_list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询电梯信息"
,
notes
=
"分页查询电梯信息"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询电梯信息"
,
notes
=
"分页查询电梯信息"
)
public
IPage
<
ElevatorVo
>
queryElevatorList
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
public
ResponseModel
<
IPage
<
ElevatorVo
>>
queryElevatorList
(
String
pageNum
,
String
pageSize
,
ElevatorDto
elevatorDto
)
{
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Elevator
elevator
=
BeanDtoVoUtils
.
convert
(
elevatorDto
,
Elevator
.
class
);
Page
<
Elevator
>
pageBean
;
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
...
@@ -195,7 +202,8 @@ public class ElevatorController extends BaseController {
...
@@ -195,7 +202,8 @@ public class ElevatorController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
}
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
BeanDtoVoUtils
.
elevatorIPageVo
(
page
);
IPage
<
ElevatorVo
>
elevatorVoIPage
=
BeanDtoVoUtils
.
elevatorIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
elevatorVoIPage
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/MaintenanceUnitController.java
View file @
2c921e4b
...
@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
...
@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import
com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -19,9 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -19,9 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
/**
/**
...
@@ -48,9 +48,10 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -48,9 +48,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增维保单位"
,
notes
=
"新增维保单位"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增维保单位"
,
notes
=
"新增维保单位"
)
public
boolean
saveMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
public
ResponseModel
<
Boolean
>
saveMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
return
iMaintenanceUnitService
.
save
(
maintenanceUnit
);
boolean
save
=
iMaintenanceUnitService
.
save
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
save
);
}
}
/**
/**
...
@@ -62,8 +63,9 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -62,8 +63,9 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
return
iMaintenanceUnitService
.
removeById
(
id
);
boolean
remove
=
iMaintenanceUnitService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
}
/**
/**
...
@@ -75,9 +77,10 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -75,9 +77,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改维保单位"
,
notes
=
"修改维保单位"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改维保单位"
,
notes
=
"修改维保单位"
)
public
boolean
updateByIdMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
public
ResponseModel
<
Boolean
>
updateByIdMaintenanceUnit
(
@RequestBody
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
return
iMaintenanceUnitService
.
updateById
(
maintenanceUnit
);
boolean
update
=
iMaintenanceUnitService
.
updateById
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
update
);
}
}
/**
/**
...
@@ -89,9 +92,10 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -89,9 +92,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
MaintenanceUnitVo
selectById
(
@PathVariable
Long
id
)
{
public
ResponseModel
<
MaintenanceUnitVo
>
selectById
(
@PathVariable
Long
id
)
{
MaintenanceUnit
maintenanceUnit
=
iMaintenanceUnitService
.
getById
(
id
);
MaintenanceUnit
maintenanceUnit
=
iMaintenanceUnitService
.
getById
(
id
);
return
BeanDtoVoUtils
.
convertMaintenanceUnitEntityToVo
(
maintenanceUnit
);
MaintenanceUnitVo
maintenanceUnitVo
=
BeanDtoVoUtils
.
convertMaintenanceUnitToVo
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
maintenanceUnitVo
);
}
}
/**
/**
...
@@ -105,7 +109,8 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -105,7 +109,8 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
MaintenanceUnitVo
>
listPage
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
public
ResponseModel
<
IPage
<
MaintenanceUnitVo
>>
listPage
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
Page
<
MaintenanceUnit
>
pageBean
;
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
...
@@ -142,7 +147,8 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -142,7 +147,8 @@ public class MaintenanceUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
}
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
BeanDtoVoUtils
.
maintenanceUnitIPageVo
(
page
);
IPage
<
MaintenanceUnitVo
>
maintenanceUnitVoIPage
=
BeanDtoVoUtils
.
maintenanceUnitIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
maintenanceUnitVoIPage
);
}
}
/**
/**
...
@@ -156,8 +162,8 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -156,8 +162,8 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_maintenance_unit_list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/query_maintenance_unit_list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询维保单位信息"
,
notes
=
"分页查询维保单位信息"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询维保单位信息"
,
notes
=
"分页查询维保单位信息"
)
public
IPage
<
MaintenanceUnitVo
>
queryMaintenanceUnitList
(
String
pageNum
,
String
pageSize
,
public
ResponseModel
<
IPage
<
MaintenanceUnitVo
>
>
queryMaintenanceUnitList
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
Page
<
MaintenanceUnit
>
pageBean
;
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
...
@@ -190,7 +196,8 @@ public class MaintenanceUnitController extends BaseController {
...
@@ -190,7 +196,8 @@ public class MaintenanceUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
}
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
BeanDtoVoUtils
.
maintenanceUnitIPageVo
(
page
);
IPage
<
MaintenanceUnitVo
>
maintenanceUnitVoIPage
=
BeanDtoVoUtils
.
maintenanceUnitIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
maintenanceUnitVoIPage
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/UseUnitController.java
View file @
2c921e4b
...
@@ -14,6 +14,8 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
...
@@ -14,6 +14,8 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -25,7 +27,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...
@@ -25,7 +27,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -39,6 +40,7 @@ import java.util.Arrays;
...
@@ -39,6 +40,7 @@ import java.util.Arrays;
@Api
(
tags
=
"使用单位Api"
)
@Api
(
tags
=
"使用单位Api"
)
@RequestMapping
(
value
=
"/tzs/use-unit"
)
@RequestMapping
(
value
=
"/tzs/use-unit"
)
public
class
UseUnitController
extends
BaseController
{
public
class
UseUnitController
extends
BaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ElevatorController
.
class
);
@Autowired
@Autowired
IUseUnitService
iUseUnitService
;
IUseUnitService
iUseUnitService
;
...
@@ -52,52 +54,55 @@ public class UseUnitController extends BaseController {
...
@@ -52,52 +54,55 @@ public class UseUnitController extends BaseController {
/**
/**
* 新增使用单位
* 新增使用单位
*
*
* @return
* @param useUnit 使用单位
* @return 返回结果
*/
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增使用单位"
,
notes
=
"新增使用单位"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增使用单位"
,
notes
=
"新增使用单位"
)
public
boolean
saveUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
public
ResponseModel
<
Boolean
>
saveUseUnit
(
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
save
(
useUnit
);
boolean
save
=
iUseUnitService
.
save
(
useUnit
);
return
ResponseHelper
.
buildResponse
(
save
);
}
}
/**
/**
* 根据id删除
* 根据id删除
*
*
* @param id
* @param id
id
* @return
* @return
返回结果
*/
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
return
iUseUnitService
.
removeById
(
id
);
boolean
remove
=
iUseUnitService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
}
/**
/**
* 修改使用单位
* 修改使用单位
*
*
* @return
* @param useUnit 使用单位
* @return 返回结果
*/
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改使用单位"
,
notes
=
"修改使用单位"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改使用单位"
,
notes
=
"修改使用单位"
)
public
boolean
updateByIdUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
public
ResponseModel
<
Boolean
>
updateByIdUseUnit
(
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
updateById
(
useUnit
);
boolean
update
=
iUseUnitService
.
updateById
(
useUnit
);
return
ResponseHelper
.
buildResponse
(
update
);
}
}
/**
/**
* 获取消防建筑树
* 获取消防建筑树
*
*
* @return
* @return
返回结果
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/buildingTree"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/buildingTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取消防建筑树"
,
notes
=
"获取消防建筑树"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取消防建筑树"
,
notes
=
"获取消防建筑树"
)
public
ResponseModel
<
Object
>
getBuildingTreeAndEquip
()
{
public
ResponseModel
<
Object
>
getBuildingTreeAndEquip
()
{
ResponseModel
<
Object
>
result
=
equipFeignService
.
getBuildingTreeAndEquip
();
return
equipFeignService
.
getBuildingTreeAndEquip
();
return
result
;
}
}
/**
/**
...
@@ -109,22 +114,22 @@ public class UseUnitController extends BaseController {
...
@@ -109,22 +114,22 @@ public class UseUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
UseUnitVo
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
public
ResponseModel
<
UseUnitVo
>
selectById
(
@PathVariable
Long
id
)
{
UseUnit
useUnit
=
iUseUnitService
.
getById
(
id
);
UseUnit
useUnit
=
iUseUnitService
.
getById
(
id
);
UseUnitVo
useUnitVo
=
BeanDtoVoUtils
.
convert
(
useUnit
,
UseUnitVo
.
class
);
UseUnitVo
useUnitVo
=
BeanDtoVoUtils
.
convert
(
useUnit
,
UseUnitVo
.
class
);
return
useUnitVo
;
return
ResponseHelper
.
buildResponse
(
useUnitVo
)
;
}
}
/**
/**
* 获取平台字典
* 获取平台字典
*
*
* @return
* @param dictCode 字典编号
* @return 返回结果
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/dict/{dictCode}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/dict/{dictCode}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取平台字典"
,
notes
=
"获取平台字典"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取平台字典"
,
notes
=
"获取平台字典"
)
public
ResponseModel
<
Object
>
getDict
(
HttpServletRequest
request
,
public
ResponseModel
<
Object
>
getDict
(
@PathVariable
(
value
=
"dictCode"
)
String
dictCode
)
{
@PathVariable
(
value
=
"dictCode"
)
String
dictCode
)
{
ResponseModel
<
Object
>
result
=
new
ResponseModel
<>();
ResponseModel
<
Object
>
result
=
new
ResponseModel
<>();
try
{
try
{
result
=
ResponseHelper
.
buildResponse
(
amosFeignService
.
listDictionaryByDictCode
(
dictCode
));
result
=
ResponseHelper
.
buildResponse
(
amosFeignService
.
listDictionaryByDictCode
(
dictCode
));
...
@@ -137,12 +142,15 @@ public class UseUnitController extends BaseController {
...
@@ -137,12 +142,15 @@ public class UseUnitController extends BaseController {
/**
/**
* 列表分页查询
* 列表分页查询
*
*
* @return
* @param pageNum 页码
* @param pageSize 每页大小
* @param useUnit 查询参数
* @return 返回结果
*/
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
UseUnit
>
listPage
(
String
pageNum
,
String
pageSize
,
UseUnit
useUnit
)
{
public
ResponseModel
<
IPage
<
UseUnit
>
>
listPage
(
String
pageNum
,
String
pageSize
,
UseUnit
useUnit
)
{
Page
<
UseUnit
>
pageBean
;
Page
<
UseUnit
>
pageBean
;
QueryWrapper
<
UseUnit
>
useUnitQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
UseUnit
>
useUnitQueryWrapper
=
new
QueryWrapper
<>();
...
@@ -169,6 +177,7 @@ public class UseUnitController extends BaseController {
...
@@ -169,6 +177,7 @@ public class UseUnitController extends BaseController {
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
}
});
});
IPage
<
UseUnit
>
page
;
IPage
<
UseUnit
>
page
;
...
@@ -178,7 +187,7 @@ public class UseUnitController extends BaseController {
...
@@ -178,7 +187,7 @@ public class UseUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
}
page
=
iUseUnitService
.
page
(
pageBean
,
useUnitQueryWrapper
);
page
=
iUseUnitService
.
page
(
pageBean
,
useUnitQueryWrapper
);
return
page
;
return
ResponseHelper
.
buildResponse
(
page
)
;
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
View file @
2c921e4b
...
@@ -6,18 +6,14 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
...
@@ -6,18 +6,14 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.ElevatorVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.ElevatorVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.controller.ElevatorController
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
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.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.util.
List
;
import
java.util.
*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
...
@@ -28,8 +24,6 @@ import java.util.stream.Stream;
...
@@ -28,8 +24,6 @@ import java.util.stream.Stream;
@Component
@Component
public
class
BeanDtoVoUtils
{
public
class
BeanDtoVoUtils
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BeanDtoVoUtils
.
class
);
@Autowired
@Autowired
private
AmosFeignService
amosFeignService
;
private
AmosFeignService
amosFeignService
;
...
@@ -48,6 +42,11 @@ public class BeanDtoVoUtils {
...
@@ -48,6 +42,11 @@ public class BeanDtoVoUtils {
beanDtoVoUtils
.
amosFeignService
=
this
.
amosFeignService
;
beanDtoVoUtils
.
amosFeignService
=
this
.
amosFeignService
;
}
}
/**
* 获取电梯信息中数据字典的值
*
* @throws Exception 获取字典值错误
*/
public
static
void
getElevatorDictionaryByDictCode
()
throws
Exception
{
public
static
void
getElevatorDictionaryByDictCode
()
throws
Exception
{
elevatorCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_CATEGORY"
);
elevatorCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_CATEGORY"
);
elevatorUseSiteCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
elevatorUseSiteCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
...
@@ -57,6 +56,11 @@ public class BeanDtoVoUtils {
...
@@ -57,6 +56,11 @@ public class BeanDtoVoUtils {
elevatorDragMode
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_DRAG_MODE"
);
elevatorDragMode
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_DRAG_MODE"
);
}
}
/**
* 获取维保单位中数据字典的值
*
* @throws Exception 获取字典值错误
*/
public
static
void
getMaintenanceUnitDictionaryByDictCode
()
throws
Exception
{
public
static
void
getMaintenanceUnitDictionaryByDictCode
()
throws
Exception
{
qualificationLevel
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
qualificationLevel
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"MAINTENANCE_UNIT_QUALIFICATION_LEVEL"
);
"MAINTENANCE_UNIT_QUALIFICATION_LEVEL"
);
...
@@ -112,7 +116,13 @@ public class BeanDtoVoUtils {
...
@@ -112,7 +116,13 @@ public class BeanDtoVoUtils {
});
});
}
}
public
static
ElevatorVo
convertElevatorEntityToVo
(
Elevator
source
)
{
/**
* 将电梯实体类转换为Vo
*
* @param source 实体类
* @return Vo类
*/
public
static
ElevatorVo
convertElevatorToVo
(
Elevator
source
)
{
// 判断source是否为空
// 判断source是否为空
if
(
source
==
null
)
{
if
(
source
==
null
)
{
return
null
;
return
null
;
...
@@ -122,6 +132,12 @@ public class BeanDtoVoUtils {
...
@@ -122,6 +132,12 @@ public class BeanDtoVoUtils {
ElevatorVo
target
=
new
ElevatorVo
();
ElevatorVo
target
=
new
ElevatorVo
();
// 把原对象数据拷贝到新对象
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
BeanUtils
.
copyProperties
(
source
,
target
);
// 将设备图片转换为集合
String
photos
=
source
.
getPhotos
();
if
(
photos
!=
null
)
{
String
[]
photoList
=
photos
.
split
(
","
);
target
.
setImg
(
Arrays
.
stream
(
photoList
).
map
(
ElevatorVo
.
Img
::
new
).
collect
(
Collectors
.
toList
()));
}
// 根据数据字典设置值
// 根据数据字典设置值
getElevatorDictionaryByDictCode
();
getElevatorDictionaryByDictCode
();
List
<
DictionarieValueModel
>
categoryValue
=
List
<
DictionarieValueModel
>
categoryValue
=
...
@@ -149,72 +165,29 @@ public class BeanDtoVoUtils {
...
@@ -149,72 +165,29 @@ public class BeanDtoVoUtils {
}
}
}
}
public
static
ElevatorVo
convertElevatorEntityToVo2
(
Elevator
source
,
List
<
DictionarieValueModel
>
elevatorCategory
,
List
<
DictionarieValueModel
>
elevatorUseSiteCategory
,
List
<
DictionarieValueModel
>
elevatorMaintainType
,
List
<
DictionarieValueModel
>
elevatorMaintainPeriod
,
List
<
DictionarieValueModel
>
elevatorDragMode
)
{
// 判断source是否为空
if
(
source
==
null
)
{
return
null
;
}
try
{
// 创建新的对象实例
ElevatorVo
target
=
new
ElevatorVo
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
// 根据数据字典设置值
List
<
DictionarieValueModel
>
collect
=
elevatorCategory
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getCategory
())).
collect
(
Collectors
.
toList
());
target
.
setCategory
(
collect
.
isEmpty
()
?
""
:
collect
.
get
(
0
).
getDictDataValue
());
Stream
<
DictionarieValueModel
>
dictionarieValueModelStream
=
elevatorUseSiteCategory
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getUseSiteCategory
()));
target
.
setUseSiteCategory
(
elevatorUseSiteCategory
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getUseSiteCategory
())).
collect
(
Collectors
.
toList
()).
get
(
0
).
getDictDataValue
());
target
.
setMaintainType
(
elevatorMaintainType
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getMaintainType
())).
collect
(
Collectors
.
toList
()).
get
(
0
).
getDictDataValue
());
target
.
setMaintainPeriod
(
elevatorMaintainPeriod
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getMaintainPeriod
())).
collect
(
Collectors
.
toList
()).
get
(
0
).
getDictDataValue
());
target
.
setDragMode
(
elevatorDragMode
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getDragMode
())).
collect
(
Collectors
.
toList
()).
get
(
0
).
getDictDataValue
());
// 返回新对象
return
target
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
/**
* 将Elevator转换
位
IPage<ElevatorVo>
* 将Elevator转换
为
IPage<ElevatorVo>
*
*
* @param page 原分页对象
* @param page 原分页对象
* @return
* @return
转换后的Vo
*/
*/
public
static
IPage
<
ElevatorVo
>
elevatorIPageVo
(
IPage
<
Elevator
>
page
)
{
public
static
IPage
<
ElevatorVo
>
elevatorIPageVo
(
IPage
<
Elevator
>
page
)
{
return
page
.
convert
(
item
->
{
return
page
.
convert
(
item
->
{
try
{
try
{
return
convertElevator
Entity
ToVo
(
item
);
return
convertElevatorToVo
(
item
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
null
;
return
null
;
}
}
});
});
}
}
public
static
IPage
<
ElevatorVo
>
elevatorIPageVo2
(
IPage
<
Elevator
>
page
,
List
<
DictionarieValueModel
>
elevatorCategory
/**
,
List
<
DictionarieValueModel
>
elevatorUseSiteCategory
,
List
<
DictionarieValueModel
>
elevatorMaintainType
,
* 将MaintenanceUnit转换为Vo
List
<
DictionarieValueModel
>
elevatorMaintainPeriod
,
*
List
<
DictionarieValueModel
>
elevatorDragMode
)
{
* @param source 源对象
return
page
.
convert
(
item
->
{
* @return 转换后的Vo
try
{
*/
return
convertElevatorEntityToVo2
(
item
,
elevatorCategory
public
static
MaintenanceUnitVo
convertMaintenanceUnitToVo
(
MaintenanceUnit
source
)
{
,
elevatorUseSiteCategory
,
elevatorMaintainType
,
elevatorMaintainPeriod
,
elevatorDragMode
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
public
static
MaintenanceUnitVo
convertMaintenanceUnitEntityToVo
(
MaintenanceUnit
source
)
{
// 判断source是否为空
// 判断source是否为空
if
(
source
==
null
)
{
if
(
source
==
null
)
{
return
null
;
return
null
;
...
@@ -238,15 +211,15 @@ public class BeanDtoVoUtils {
...
@@ -238,15 +211,15 @@ public class BeanDtoVoUtils {
}
}
/**
/**
* 将
Elevator转换位IPage<Elevator
Vo>
* 将
MaintenanceUnit转换为IPage<MaintenanceUnit
Vo>
*
*
* @param page 原分页对象
* @param page 原分页对象
* @return
* @return
转换后的分页对象
*/
*/
public
static
IPage
<
MaintenanceUnitVo
>
maintenanceUnitIPageVo
(
IPage
<
MaintenanceUnit
>
page
)
{
public
static
IPage
<
MaintenanceUnitVo
>
maintenanceUnitIPageVo
(
IPage
<
MaintenanceUnit
>
page
)
{
return
page
.
convert
(
item
->
{
return
page
.
convert
(
item
->
{
try
{
try
{
return
convertMaintenanceUnit
Entity
ToVo
(
item
);
return
convertMaintenanceUnitToVo
(
item
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
null
;
return
null
;
}
}
...
...
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