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
42d80bf0
Commit
42d80bf0
authored
Jun 10, 2021
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/moa/amos-boot-biz
into developer
parents
763c2b16
6b5ea7b0
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
502 additions
and
156 deletions
+502
-156
.gitignore
.gitignore
+5
-0
AmosFeignService.java
.../yeejoin/amos/boot/biz/common/feign/AmosFeignService.java
+1
-1
GlobalCache.java
...a/com/yeejoin/amos/boot/biz/common/utils/GlobalCache.java
+26
-0
application-dev.properties
...-jcs-system/src/main/resources/application-dev.properties
+3
-0
ElevatorDto.java
...com/yeejoin/amos/boot/module/tzs/api/dto/ElevatorDto.java
+1
-1
MaintenanceUnitDto.java
...join/amos/boot/module/tzs/api/dto/MaintenanceUnitDto.java
+5
-11
RescueStationDto.java
...eejoin/amos/boot/module/tzs/api/dto/RescueStationDto.java
+5
-11
UseUnitDto.java
.../com/yeejoin/amos/boot/module/tzs/api/dto/UseUnitDto.java
+5
-11
Elevator.java
...com/yeejoin/amos/boot/module/tzs/api/entity/Elevator.java
+1
-1
MaintenanceUnit.java
...join/amos/boot/module/tzs/api/entity/MaintenanceUnit.java
+5
-11
RescueStation.java
...eejoin/amos/boot/module/tzs/api/entity/RescueStation.java
+5
-11
UseUnit.java
.../com/yeejoin/amos/boot/module/tzs/api/entity/UseUnit.java
+5
-11
ElevatorVo.java
...a/com/yeejoin/amos/boot/module/tzs/api/vo/ElevatorVo.java
+19
-1
MaintenanceUnitVo.java
...eejoin/amos/boot/module/tzs/api/vo/MaintenanceUnitVo.java
+6
-11
RescueStationVo.java
.../yeejoin/amos/boot/module/tzs/api/vo/RescueStationVo.java
+7
-12
UseUnitVo.java
...va/com/yeejoin/amos/boot/module/tzs/api/vo/UseUnitVo.java
+7
-12
ControllerAop.java
...m/yeejoin/amos/boot/module/jcs/biz/aop/ControllerAop.java
+149
-0
ElevatorController.java
...os/boot/module/tzs/biz/controller/ElevatorController.java
+21
-12
MaintenanceUnitController.java
.../module/tzs/biz/controller/MaintenanceUnitController.java
+22
-13
UseUnitController.java
...mos/boot/module/tzs/biz/controller/UseUnitController.java
+32
-23
BeanDtoVoUtils.java
...eejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
+169
-1
application.properties
...boot-tzs-system/src/main/resources/application.properties
+3
-2
No files found.
.gitignore
View file @
42d80bf0
target/
/.idea/
*.iml
.classpath
.project
/org.eclipse
.settings
\ No newline at end of file
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/feign/AmosFeignService.java
View file @
42d80bf0
...
...
@@ -25,7 +25,7 @@ public class AmosFeignService {
* @param dictCode
* @return
*/
public
Object
listDictionaryByDictCode
(
String
dictCode
)
throws
Exception
{
public
List
<
DictionarieValueModel
>
listDictionaryByDictCode
(
String
dictCode
)
throws
Exception
{
logger
.
info
(
"===========>listDictionaryByDictCode方法请求参数:{}"
,
dictCode
);
List
<
DictionarieValueModel
>
dictionaryModel
;
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/GlobalCache.java
0 → 100644
View file @
42d80bf0
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @Description: 全局单机缓存
* @Author: duanwei
* @Date: 2020/6/30
*/
public
class
GlobalCache
{
/**
* 全局请求头
*/
public
static
Map
<
String
,
String
>
header
=
new
ConcurrentHashMap
<>();
/**
* 依赖参数容器
*/
public
static
Map
<
String
,
String
>
paramMap
=
new
ConcurrentHashMap
<>(
1000
);
}
amos-boot-jcs-system/src/main/resources/application-dev.properties
View file @
42d80bf0
...
...
@@ -23,4 +23,7 @@ spring.redis.expire.time=300
security.systemctl.name
=
AMOS-API-SYSTEMCTL
# 区域选择存放redis失效时间一个月
redis_region_time_second
=
2592000
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/ElevatorDto.java
View file @
42d80bf0
...
...
@@ -70,7 +70,7 @@ public class ElevatorDto extends BaseEntity {
private
String
category
;
@ApiModelProperty
(
value
=
"使用场所分类"
)
private
String
useSiteCateg
ro
y
;
private
String
useSiteCateg
or
y
;
@ApiModelProperty
(
value
=
"电梯型号"
)
private
String
model
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/MaintenanceUnitDto.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"cb_maintenance_unit"
)
@ApiModel
(
value
=
"MaintenanceUnitDto"
,
description
=
"
"
)
@ApiModel
(
value
=
"MaintenanceUnitDto"
,
description
=
"MaintenanceUnitDto
"
)
public
class
MaintenanceUnitDto
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/RescueStationDto.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_rescue_station"
)
@ApiModel
(
value
=
"RescueStationDto"
,
description
=
"
"
)
@ApiModel
(
value
=
"RescueStationDto"
,
description
=
"RescueStationDto
"
)
public
class
RescueStationDto
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/UseUnitDto.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_use_unit"
)
@ApiModel
(
value
=
"UseUnitDto"
,
description
=
"
"
)
@ApiModel
(
value
=
"UseUnitDto"
,
description
=
"UseUnitDto
"
)
public
class
UseUnitDto
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/Elevator.java
View file @
42d80bf0
...
...
@@ -71,7 +71,7 @@ public class Elevator extends BaseEntity {
private
String
category
;
@ApiModelProperty
(
value
=
"使用场所分类"
)
private
String
useSiteCateg
ro
y
;
private
String
useSiteCateg
or
y
;
@ApiModelProperty
(
value
=
"电梯型号"
)
private
String
model
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/MaintenanceUnit.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"cb_maintenance_unit"
)
@ApiModel
(
value
=
"MaintenanceUnit对象"
,
description
=
"
"
)
@ApiModel
(
value
=
"MaintenanceUnit对象"
,
description
=
"MaintenanceUnit对象
"
)
public
class
MaintenanceUnit
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/RescueStation.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_rescue_station"
)
@ApiModel
(
value
=
"RescueStation对象"
,
description
=
"
"
)
@ApiModel
(
value
=
"RescueStation对象"
,
description
=
"RescueStation对象
"
)
public
class
RescueStation
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/UseUnit.java
View file @
42d80bf0
...
...
@@ -7,22 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_use_unit"
)
@ApiModel
(
value
=
"UseUnit对象"
,
description
=
"
"
)
@ApiModel
(
value
=
"UseUnit对象"
,
description
=
"UseUnit对象
"
)
public
class
UseUnit
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
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 @
42d80bf0
...
...
@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.tzs.api.vo;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.util.Date
;
import
java.util.List
;
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
;
/**
...
...
@@ -15,6 +17,7 @@ import lombok.experimental.Accessors;
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_elevator"
)
@ApiModel
(
value
=
"ElevatorVo"
,
description
=
"ElevatorVo"
)
...
...
@@ -69,7 +72,7 @@ public class ElevatorVo extends BaseEntity {
private
String
category
;
@ApiModelProperty
(
value
=
"使用场所分类"
)
private
String
useSiteCateg
ro
y
;
private
String
useSiteCateg
or
y
;
@ApiModelProperty
(
value
=
"电梯型号"
)
private
String
model
;
...
...
@@ -191,7 +194,22 @@ public class ElevatorVo extends BaseEntity {
@ApiModelProperty
(
value
=
"设备图片"
)
private
String
photos
;
@ApiModelProperty
(
value
=
"设备图片"
)
private
List
<
Img
>
img
;
@ApiModelProperty
(
value
=
"原始表id(来自历史数据库)"
)
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-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/MaintenanceUnitVo.java
View file @
42d80bf0
...
...
@@ -7,21 +7,16 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"cb_maintenance_unit"
)
@ApiModel
(
value
=
"MaintenanceUnitVo"
,
description
=
"
"
)
@ApiModel
(
value
=
"MaintenanceUnitVo"
,
description
=
"MaintenanceUnitVo
"
)
public
class
MaintenanceUnitVo
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/RescueStationVo.java
View file @
42d80bf0
...
...
@@ -7,22 +7,17 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_rescue_station"
)
@ApiModel
(
value
=
"RescueStationVo"
,
description
=
"
"
)
public
class
RescueStationVo
extends
BaseEntity
{
@ApiModel
(
value
=
"RescueStationVo"
,
description
=
"RescueStationVo
"
)
public
class
RescueStationVo
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/UseUnitVo.java
View file @
42d80bf0
...
...
@@ -7,22 +7,17 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
/**
*
*
* @author tb
* @date 2021-06-01
*/
* @author tb
* @date 2021-06-01
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tcb_use_unit"
)
@ApiModel
(
value
=
"UseUnitVo"
,
description
=
"
"
)
public
class
UseUnitVo
extends
BaseEntity
{
@ApiModel
(
value
=
"UseUnitVo"
,
description
=
"UseUnitVo
"
)
public
class
UseUnitVo
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/aop/ControllerAop.java
0 → 100644
View file @
42d80bf0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
aop
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.DepartmentBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.RoleBo
;
import
com.yeejoin.amos.boot.biz.common.utils.GlobalCache
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
//import com.yeejoin.equipmanage.common.config.GlobalCache;
//import com.yeejoin.equipmanage.common.utils.RedisUtils;
//import com.yeejoin.equipmanage.remote.CompanyBo;
//import com.yeejoin.equipmanage.remote.DepartmentBo;
//import com.yeejoin.equipmanage.remote.ReginParams;
//import com.yeejoin.equipmanage.remote.RoleBo;
/**
* controller层切面 用于用户数据缓存 供 sql自动填充使用
*
* @author Admin
*/
@Aspect
@Component
public
class
ControllerAop
{
/**
* saveUserRedis设置过期时间
*/
@Value
(
"${redis_region_time_second}"
)
private
Long
redisRegionTimeSecond
;
@Autowired
private
RedisUtils
redisUtils
;
@Pointcut
(
"execution(public * com.yeejoin.amos.boot.module.jcs.biz.controller..*(..))"
)
public
void
userCache
()
{
}
@Before
(
"userCache()"
)
public
void
doBefore
(
JoinPoint
joinPoint
)
throws
Throwable
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
String
token
=
request
.
getHeader
(
"token"
);
if
(
token
!=
null
)
{
String
product
=
request
.
getHeader
(
"product"
);
String
appKey
=
request
.
getHeader
(
"appKey"
);
RequestContext
.
setToken
(
token
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
FeignClientResult
<
AgencyUserModel
>
feignClientResult
=
Privilege
.
agencyUserClient
.
getme
();
AgencyUserModel
userModel
=
feignClientResult
.
getResult
();
if
(
userModel
==
null
)
{
throw
new
Exception
(
"无法获取用户信息"
);
}
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
String
key
=
"region_"
+
userModel
.
getUserId
()
+
"_"
+
token
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"user"
,
JSON
.
toJSONString
(
userModel
));
// 不需要添加请求头的接口
String
[]
url
=
new
String
[]{
"/api/user/selectInfo"
,
"/api/user/save/curCompany"
};
System
.
out
.
println
((
Arrays
.
asList
(
url
).
toString
()));
System
.
out
.
println
(
request
.
getRequestURI
());
// 获取请求路径
if
(
Arrays
.
asList
(
url
).
contains
(
request
.
getRequestURI
()))
{
// 暂无需要
}
else
{
if
(
redisUtils
.
hasKey
(
key
))
{
map
.
put
(
"org"
,
redisUtils
.
get
(
key
).
toString
());
GlobalCache
.
paramMap
.
put
(
token
,
JSON
.
toJSONString
(
map
));
}
else
{
saveUserRedis
(
userModel
,
token
);
}
}
}
}
public
void
saveUserRedis
(
AgencyUserModel
user
,
String
token
)
{
CompanyBo
company
=
new
CompanyBo
();
DepartmentBo
department
=
new
DepartmentBo
();
RoleBo
role
=
new
RoleBo
();
CompanyModel
companyM
=
user
.
getCompanys
().
get
(
0
);
Bean
.
copyExistPropertis
(
companyM
,
company
);
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
DepartmentModel
departmentM
=
mapDepartments
.
get
(
companyM
.
getSequenceNbr
()).
get
(
0
);
Bean
.
copyExistPropertis
(
departmentM
,
department
);
Map
<
Long
,
List
<
RoleModel
>>
roles
=
user
.
getOrgRoles
();
Long
sequenceNbr
;
if
(
departmentM
==
null
)
{
sequenceNbr
=
null
;
}
else
{
sequenceNbr
=
departmentM
.
getSequenceNbr
();
}
RoleModel
roleM
=
null
;
if
(
sequenceNbr
==
null
)
{
roleM
=
roles
.
get
(
companyM
.
getSequenceNbr
()).
get
(
0
);
}
else
{
roleM
=
roles
.
get
(
sequenceNbr
).
get
(
0
);
}
Bean
.
copyExistPropertis
(
roleM
,
role
);
ReginParams
reginParams
=
new
ReginParams
();
reginParams
.
setCompany
(
company
);
reginParams
.
setRole
(
role
);
reginParams
.
setDepartment
(
department
);
redisUtils
.
set
(
buildKey
(
user
.
getUserId
(),
token
),
JSONObject
.
toJSONString
(
reginParams
),
redisRegionTimeSecond
);
}
public
String
buildKey
(
String
userId
,
String
token
)
{
return
"region_"
+
userId
+
"_"
+
token
;
}
@AfterReturning
(
returning
=
"ret"
,
pointcut
=
"userCache()"
)
public
void
doAfterReturning
(
Object
ret
)
throws
Throwable
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
String
token
=
request
.
getHeader
(
"token"
);
if
(
token
!=
null
)
{
GlobalCache
.
paramMap
.
remove
(
token
);
}
}
}
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 @
42d80bf0
...
...
@@ -24,6 +24,8 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
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
;
...
...
@@ -52,9 +54,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@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
);
return
iElevatorService
.
save
(
elevator
);
boolean
save
=
iElevatorService
.
save
(
elevator
);
return
ResponseHelper
.
buildResponse
(
save
);
}
/**
...
...
@@ -66,8 +69,9 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
return
iElevatorService
.
removeById
(
id
);
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
boolean
remove
=
iElevatorService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
/**
...
...
@@ -79,9 +83,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@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
);
return
iElevatorService
.
updateById
(
elevator
);
boolean
update
=
iElevatorService
.
updateById
(
elevator
);
return
ResponseHelper
.
buildResponse
(
update
);
}
...
...
@@ -94,9 +99,10 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@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
);
return
BeanDtoVoUtils
.
convert
(
elevator
,
ElevatorVo
.
class
);
ElevatorVo
elevatorVo
=
BeanDtoVoUtils
.
convertElevatorToVo
(
elevator
);
return
ResponseHelper
.
buildResponse
(
elevatorVo
);
}
/**
...
...
@@ -110,7 +116,7 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@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
);
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -147,7 +153,8 @@ public class ElevatorController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
ElevatorVo
.
class
);
IPage
<
ElevatorVo
>
elevatorVoIPage
=
BeanDtoVoUtils
.
elevatorIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
elevatorVoIPage
);
}
/**
...
...
@@ -161,7 +168,8 @@ public class ElevatorController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_elevator_list"
,
method
=
RequestMethod
.
GET
)
@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
);
Page
<
Elevator
>
pageBean
;
QueryWrapper
<
Elevator
>
elevatorQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -194,7 +202,8 @@ public class ElevatorController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iElevatorService
.
page
(
pageBean
,
elevatorQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
ElevatorVo
.
class
);
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 @
42d80bf0
...
...
@@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
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
;
...
...
@@ -46,9 +48,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@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
);
return
iMaintenanceUnitService
.
save
(
maintenanceUnit
);
boolean
save
=
iMaintenanceUnitService
.
save
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
save
);
}
/**
...
...
@@ -60,8 +63,9 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
@PathVariable
Long
id
)
{
return
iMaintenanceUnitService
.
removeById
(
id
);
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
boolean
remove
=
iMaintenanceUnitService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
/**
...
...
@@ -73,9 +77,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@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
);
return
iMaintenanceUnitService
.
updateById
(
maintenanceUnit
);
boolean
update
=
iMaintenanceUnitService
.
updateById
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
update
);
}
/**
...
...
@@ -87,9 +92,10 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@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
);
return
BeanDtoVoUtils
.
convert
(
maintenanceUnit
,
MaintenanceUnitVo
.
class
);
MaintenanceUnitVo
maintenanceUnitVo
=
BeanDtoVoUtils
.
convertMaintenanceUnitToVo
(
maintenanceUnit
);
return
ResponseHelper
.
buildResponse
(
maintenanceUnitVo
);
}
/**
...
...
@@ -103,7 +109,8 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@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
);
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -140,7 +147,8 @@ public class MaintenanceUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
MaintenanceUnitVo
.
class
);
IPage
<
MaintenanceUnitVo
>
maintenanceUnitVoIPage
=
BeanDtoVoUtils
.
maintenanceUnitIPageVo
(
page
);
return
ResponseHelper
.
buildResponse
(
maintenanceUnitVoIPage
);
}
/**
...
...
@@ -154,8 +162,8 @@ public class MaintenanceUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/query_maintenance_unit_list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询维保单位信息"
,
notes
=
"分页查询维保单位信息"
)
public
IPage
<
MaintenanceUnitVo
>
queryMaintenanceUnitList
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
public
ResponseModel
<
IPage
<
MaintenanceUnitVo
>
>
queryMaintenanceUnitList
(
String
pageNum
,
String
pageSize
,
MaintenanceUnit
maintenanceUnitDto
)
{
MaintenanceUnit
maintenanceUnit
=
BeanDtoVoUtils
.
convert
(
maintenanceUnitDto
,
MaintenanceUnit
.
class
);
Page
<
MaintenanceUnit
>
pageBean
;
QueryWrapper
<
MaintenanceUnit
>
maintenanceUnitQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -188,7 +196,8 @@ public class MaintenanceUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iMaintenanceUnitService
.
page
(
pageBean
,
maintenanceUnitQueryWrapper
);
return
BeanDtoVoUtils
.
iPageVoStream
(
page
,
MaintenanceUnitVo
.
class
);
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 @
42d80bf0
...
...
@@ -14,6 +14,8 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -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.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
...
...
@@ -39,6 +40,7 @@ import java.util.Arrays;
@Api
(
tags
=
"使用单位Api"
)
@RequestMapping
(
value
=
"/tzs/use-unit"
)
public
class
UseUnitController
extends
BaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ElevatorController
.
class
);
@Autowired
IUseUnitService
iUseUnitService
;
...
...
@@ -52,52 +54,55 @@ public class UseUnitController extends BaseController {
/**
* 新增使用单位
*
* @return
* @param useUnit 使用单位
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增使用单位"
,
notes
=
"新增使用单位"
)
public
boolean
saveUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
save
(
useUnit
);
public
ResponseModel
<
Boolean
>
saveUseUnit
(
@RequestBody
UseUnit
useUnit
)
{
boolean
save
=
iUseUnitService
.
save
(
useUnit
);
return
ResponseHelper
.
buildResponse
(
save
);
}
/**
* 根据id删除
*
* @param id
* @return
* @param id
id
* @return
返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iUseUnitService
.
removeById
(
id
);
public
ResponseModel
<
Boolean
>
deleteById
(
@PathVariable
Long
id
)
{
boolean
remove
=
iUseUnitService
.
removeById
(
id
);
return
ResponseHelper
.
buildResponse
(
remove
);
}
/**
* 修改使用单位
*
* @return
* @param useUnit 使用单位
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改使用单位"
,
notes
=
"修改使用单位"
)
public
boolean
updateByIdUseUnit
(
HttpServletRequest
request
,
@RequestBody
UseUnit
useUnit
)
{
return
iUseUnitService
.
updateById
(
useUnit
);
public
ResponseModel
<
Boolean
>
updateByIdUseUnit
(
@RequestBody
UseUnit
useUnit
)
{
boolean
update
=
iUseUnitService
.
updateById
(
useUnit
);
return
ResponseHelper
.
buildResponse
(
update
);
}
/**
* 获取消防建筑树
*
* @return
* @return
返回结果
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/buildingTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取消防建筑树"
,
notes
=
"获取消防建筑树"
)
public
ResponseModel
<
Object
>
getBuildingTreeAndEquip
()
{
ResponseModel
<
Object
>
result
=
equipFeignService
.
getBuildingTreeAndEquip
();
return
result
;
return
equipFeignService
.
getBuildingTreeAndEquip
();
}
/**
...
...
@@ -109,22 +114,22 @@ public class UseUnitController extends BaseController {
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@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
);
UseUnitVo
useUnitVo
=
BeanDtoVoUtils
.
convert
(
useUnit
,
UseUnitVo
.
class
);
return
useUnitVo
;
return
ResponseHelper
.
buildResponse
(
useUnitVo
)
;
}
/**
* 获取平台字典
*
* @return
* @param dictCode 字典编号
* @return 返回结果
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/dict/{dictCode}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取平台字典"
,
notes
=
"获取平台字典"
)
public
ResponseModel
<
Object
>
getDict
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"dictCode"
)
String
dictCode
)
{
public
ResponseModel
<
Object
>
getDict
(
@PathVariable
(
value
=
"dictCode"
)
String
dictCode
)
{
ResponseModel
<
Object
>
result
=
new
ResponseModel
<>();
try
{
result
=
ResponseHelper
.
buildResponse
(
amosFeignService
.
listDictionaryByDictCode
(
dictCode
));
...
...
@@ -137,12 +142,15 @@ public class UseUnitController extends BaseController {
/**
* 列表分页查询
*
* @return
* @param pageNum 页码
* @param pageSize 每页大小
* @param useUnit 查询参数
* @return 返回结果
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@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
;
QueryWrapper
<
UseUnit
>
useUnitQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -169,6 +177,7 @@ public class UseUnitController extends BaseController {
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
});
IPage
<
UseUnit
>
page
;
...
...
@@ -178,7 +187,7 @@ public class UseUnitController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
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 @
42d80bf0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
utils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.feign.AmosFeignService
;
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.vo.ElevatorVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -9,10 +21,54 @@ import org.springframework.beans.BeanUtils;
* @Author fpy
* @Date: 2021/6/3 13:53
*/
@Component
public
class
BeanDtoVoUtils
{
@Autowired
private
AmosFeignService
amosFeignService
;
private
static
BeanDtoVoUtils
beanDtoVoUtils
;
private
static
List
<
DictionarieValueModel
>
elevatorCategory
;
private
static
List
<
DictionarieValueModel
>
elevatorUseSiteCategory
;
private
static
List
<
DictionarieValueModel
>
elevatorMaintainType
;
private
static
List
<
DictionarieValueModel
>
elevatorMaintainPeriod
;
private
static
List
<
DictionarieValueModel
>
elevatorDragMode
;
private
static
List
<
DictionarieValueModel
>
qualificationLevel
;
@PostConstruct
public
void
init
()
{
beanDtoVoUtils
=
this
;
beanDtoVoUtils
.
amosFeignService
=
this
.
amosFeignService
;
}
/**
* 获取电梯信息中数据字典的值
*
* @throws Exception 获取字典值错误
*/
public
static
void
getElevatorDictionaryByDictCode
()
throws
Exception
{
elevatorCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_CATEGORY"
);
elevatorUseSiteCategory
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_USE_SITE_CATEGORY"
);
elevatorMaintainType
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_MAINTAIN_TYPE"
);
elevatorMaintainPeriod
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_MAINTAIN_PERIOD"
);
elevatorDragMode
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"ELEVATOR_DRAG_MODE"
);
}
/**
* 获取维保单位中数据字典的值
*
* @throws Exception 获取字典值错误
*/
public
static
void
getMaintenanceUnitDictionaryByDictCode
()
throws
Exception
{
qualificationLevel
=
beanDtoVoUtils
.
amosFeignService
.
listDictionaryByDictCode
(
"MAINTENANCE_UNIT_QUALIFICATION_LEVEL"
);
}
/**
* Dot ,
D
o ,Entity 相互转换
* Dot ,
V
o ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
...
...
@@ -36,6 +92,7 @@ public class BeanDtoVoUtils {
// 返回新对象
return
target
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
...
...
@@ -58,4 +115,114 @@ public class BeanDtoVoUtils {
}
});
}
/**
* 将电梯实体类转换为Vo
*
* @param source 实体类
* @return Vo类
*/
public
static
ElevatorVo
convertElevatorToVo
(
Elevator
source
)
{
// 判断source是否为空
if
(
source
==
null
)
{
return
null
;
}
try
{
// 创建新的对象实例
ElevatorVo
target
=
new
ElevatorVo
();
// 把原对象数据拷贝到新对象
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
();
List
<
DictionarieValueModel
>
categoryValue
=
elevatorCategory
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getCategory
())).
collect
(
Collectors
.
toList
());
target
.
setCategory
(
categoryValue
.
isEmpty
()
?
""
:
categoryValue
.
get
(
0
).
getDictDataValue
());
List
<
DictionarieValueModel
>
useSiteCategoryValue
=
elevatorUseSiteCategory
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getUseSiteCategory
())).
collect
(
Collectors
.
toList
());
target
.
setUseSiteCategory
(
useSiteCategoryValue
.
isEmpty
()
?
""
:
useSiteCategoryValue
.
get
(
0
).
getDictDataValue
());
List
<
DictionarieValueModel
>
maintainTypeValue
=
elevatorMaintainType
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getMaintainType
())).
collect
(
Collectors
.
toList
());
target
.
setMaintainType
(
maintainTypeValue
.
isEmpty
()
?
""
:
maintainTypeValue
.
get
(
0
).
getDictDataValue
());
List
<
DictionarieValueModel
>
maintainPeriodValue
=
elevatorMaintainPeriod
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getMaintainPeriod
())).
collect
(
Collectors
.
toList
());
target
.
setMaintainPeriod
(
maintainPeriodValue
.
isEmpty
()
?
""
:
maintainPeriodValue
.
get
(
0
).
getDictDataValue
());
List
<
DictionarieValueModel
>
dragModeValue
=
elevatorDragMode
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getDragMode
())).
collect
(
Collectors
.
toList
());
target
.
setDragMode
(
dragModeValue
.
isEmpty
()
?
""
:
dragModeValue
.
get
(
0
).
getDictDataValue
());
// 返回新对象
return
target
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 将Elevator转换为IPage<ElevatorVo>
*
* @param page 原分页对象
* @return 转换后的Vo
*/
public
static
IPage
<
ElevatorVo
>
elevatorIPageVo
(
IPage
<
Elevator
>
page
)
{
return
page
.
convert
(
item
->
{
try
{
return
convertElevatorToVo
(
item
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
/**
* 将MaintenanceUnit转换为Vo
*
* @param source 源对象
* @return 转换后的Vo
*/
public
static
MaintenanceUnitVo
convertMaintenanceUnitToVo
(
MaintenanceUnit
source
)
{
// 判断source是否为空
if
(
source
==
null
)
{
return
null
;
}
try
{
// 创建新的对象实例
MaintenanceUnitVo
target
=
new
MaintenanceUnitVo
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
// 返回新对象
// 根据数据字典设置值
getMaintenanceUnitDictionaryByDictCode
();
List
<
DictionarieValueModel
>
qualificationLevelValue
=
qualificationLevel
.
stream
().
filter
(
e
->
e
.
getDictDataKey
().
equals
(
source
.
getQualificationLevel
())).
collect
(
Collectors
.
toList
());
target
.
setQualificationLevel
(
qualificationLevelValue
.
isEmpty
()
?
""
:
qualificationLevelValue
.
get
(
0
).
getDictDataDesc
());
return
target
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* 将MaintenanceUnit转换为IPage<MaintenanceUnitVo>
*
* @param page 原分页对象
* @return 转换后的分页对象
*/
public
static
IPage
<
MaintenanceUnitVo
>
maintenanceUnitIPageVo
(
IPage
<
MaintenanceUnit
>
page
)
{
return
page
.
convert
(
item
->
{
try
{
return
convertMaintenanceUnitToVo
(
item
);
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
}
\ No newline at end of file
amos-boot-tzs-system/src/main/resources/application.properties
View file @
42d80bf0
spring.application.name
=
SPECIAL-EQUIPMENT
server.port
=
10000
spring.profiles.active
=
dev
\ No newline at end of file
spring.profiles.active
=
dev
server.servlet.context-path
=
/specialEquipment
\ 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