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
8f43aa12
Commit
8f43aa12
authored
Jun 28, 2021
by
付培阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消防专家接口
parent
3464d18e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
190 additions
and
25 deletions
+190
-25
FireExpertsDto.java
...ejoin/amos/boot/module/common/api/dto/FireExpertsDto.java
+7
-10
FireExperts.java
...ejoin/amos/boot/module/common/api/entity/FireExperts.java
+10
-9
pom.xml
.../amos-boot-module-biz/amos-boot-module-common-biz/pom.xml
+12
-0
FireExpertsController.java
...t/module/common/biz/controller/FireExpertsController.java
+77
-6
BeanDtoVoUtils.java
...oin/amos/boot/module/common/biz/utils/BeanDtoVoUtils.java
+84
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/FireExpertsDto.java
View file @
8f43aa12
...
...
@@ -10,20 +10,14 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
/**
*
*
* @author system_generator
* @date 2021-06-25
*/
* @author system_generator
* @date 2021-06-25
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"FireExpertsDto"
,
description
=
""
)
@ApiModel
(
value
=
"FireExpertsDto"
,
description
=
""
)
public
class
FireExpertsDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"姓名"
)
private
String
name
;
...
...
@@ -51,6 +45,9 @@ public class FireExpertsDto extends BaseDto {
@ApiModelProperty
(
value
=
"现居住地"
)
private
String
residence
;
@ApiModelProperty
(
value
=
"现居住地"
)
private
String
residenceDetails
;
@ApiModelProperty
(
value
=
"政治面貌"
)
private
String
politicalOutlook
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/FireExperts.java
View file @
8f43aa12
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
*
*
* @author system_generator
* @date 2021-06-25
*/
* @author system_generator
* @date 2021-06-25
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"cb_fire_experts"
)
@ApiModel
(
value
=
"FireExperts对象"
,
description
=
""
)
@ApiModel
(
value
=
"FireExperts对象"
,
description
=
""
)
public
class
FireExperts
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"姓名"
)
private
String
name
;
...
...
@@ -51,6 +49,9 @@ public class FireExperts extends BaseEntity {
@ApiModelProperty
(
value
=
"现居住地"
)
private
String
residence
;
@ApiModelProperty
(
value
=
"现居住地"
)
private
String
residenceDetails
;
@ApiModelProperty
(
value
=
"政治面貌"
)
private
String
politicalOutlook
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/pom.xml
View file @
8f43aa12
...
...
@@ -15,5 +15,17 @@
<artifactId>
amos-boot-module-common-api
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-jcs-api
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-jcs-biz
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/FireExpertsController.java
View file @
8f43aa12
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.utils.*
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireExperts
;
import
com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataDictionaryServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl
;
...
...
@@ -35,6 +45,12 @@ public class FireExpertsController extends BaseController {
@Autowired
FireExpertsServiceImpl
fireExpertsServiceImpl
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
DataDictionaryServiceImpl
dataDictionaryService
;
/**
* 新增
*
...
...
@@ -94,17 +110,53 @@ public class FireExpertsController extends BaseController {
*
* @param current 当前页
* @param size 每页大小
* @param fireExpertsDto 查询参数
* @return 返回结果
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<
FireExpertsDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
FireExpertsDto
>
page
=
new
Page
<>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
fireExpertsServiceImpl
.
queryForFireExpertsPage
(
page
));
public
ResponseModel
<
IPage
<
FireExpertsDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
FireExpertsDto
fireExpertsDto
)
{
FireExperts
fireExperts
=
BeanDtoVoUtils
.
convert
(
fireExpertsDto
,
FireExperts
.
class
);
Page
<
FireExperts
>
pageBean
;
QueryWrapper
<
FireExperts
>
fireExpertsQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
FireExperts
>
aClass
=
fireExperts
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Class
<?>
type
=
field
.
getType
();
Object
o
=
field
.
get
(
fireExperts
);
if
(
o
!=
null
)
{
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
"name"
.
equalsIgnoreCase
(
name
))
{
String
fileValue
=
(
String
)
o
;
fireExpertsQueryWrapper
.
like
(
name
,
fileValue
);
}
else
if
(
"expert_code"
.
equalsIgnoreCase
(
name
))
{
String
fileValue
=
(
String
)
o
;
fireExpertsQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
o
;
fireExpertsQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
o
;
fireExpertsQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
String
fileValue
=
(
String
)
o
;
fireExpertsQueryWrapper
.
like
(
name
,
fileValue
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
FireExperts
>
page
;
pageBean
=
new
Page
<>(
current
,
size
);
page
=
fireExpertsServiceImpl
.
page
(
pageBean
,
fireExpertsQueryWrapper
);
IPage
<
FireExpertsDto
>
fireExpertsDtoIPage
=
BeanDtoVoUtils
.
iPageDtoStream
(
page
,
FireExpertsDto
.
class
);
return
ResponseHelper
.
buildResponse
(
fireExpertsDtoIPage
);
}
/**
...
...
@@ -118,4 +170,23 @@ public class FireExpertsController extends BaseController {
public
ResponseModel
<
List
<
FireExpertsDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
fireExpertsServiceImpl
.
queryForFireExpertsList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getExpertsTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取专家领域树"
,
notes
=
"获取专家领域树"
)
public
ResponseModel
<
Object
>
getExpertsTree
()
throws
Exception
{
String
type
=
"ZJLY"
;
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
Collection
<
DataDictionary
>
list
=
dataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
Menu
menu
=
new
Menu
(-
1L
,
"专家领域"
,
-
1L
,
menus
);
List
<
Menu
>
menuList
=
new
ArrayList
<>();
menuList
.
add
(
menu
);
// 创建挂在主节点
return
ResponseHelper
.
buildResponse
(
menuList
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/utils/BeanDtoVoUtils.java
0 → 100644
View file @
8f43aa12
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
utils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
/**
* @title: 实体类 Dto,Vo,entity 转换工具类
* @Author fpy
* @Date: 2021/6/3 13:53
*/
@Component
public
class
BeanDtoVoUtils
{
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public
static
<
T
>
T
convert
(
Object
source
,
Class
<
T
>
targetClass
)
{
// 判断source是否为空
if
(
source
==
null
)
{
return
null
;
}
// 判断targetClass是否为空
if
(
targetClass
==
null
)
{
return
null
;
}
try
{
// 创建新的对象实例
T
target
=
targetClass
.
newInstance
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
// 返回新对象
return
target
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* IPage<Entity> 分页对象转 IPage<Dto>
*
* @param page 原分页对象
* @param v 目标vo类
* @param <E> 泛型类
* @param <V> 泛型类
* @return 转换后的分页对象
*/
public
static
<
E
,
V
>
IPage
<
V
>
iPageVoStream
(
IPage
<
E
>
page
,
Class
<
V
>
v
)
{
return
page
.
convert
(
item
->
{
try
{
return
convert
(
item
,
v
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
/**
* IPage<Entity> 分页对象转 Page<Dto>
*
* @param page 原分页对象
* @param v 目标vo类
* @param <E> 泛型类
* @param <V> 泛型类
* @return 转换后的分页对象
*/
public
static
<
E
,
V
>
IPage
<
V
>
iPageDtoStream
(
IPage
<
E
>
page
,
Class
<
V
>
v
)
{
return
page
.
convert
(
item
->
{
try
{
return
convert
(
item
,
v
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
}
\ No newline at end of file
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