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
2fc0d704
Commit
2fc0d704
authored
Nov 09, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改特种设备es 接口
parent
c928122e
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
312 additions
and
148 deletions
+312
-148
EsSpecialEquipmentDto.java
...n/amos/boot/module/tzs/api/dto/EsSpecialEquipmentDto.java
+3
-0
SpecialEquipmentDto.java
...oin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
+3
-0
EsElevator.java
...m/yeejoin/amos/boot/module/tzs/api/entity/EsElevator.java
+6
-0
AlertCalledMapper.java
...in/amos/boot/module/tzs/api/mapper/AlertCalledMapper.java
+3
-1
IAlertCalledService.java
...amos/boot/module/tzs/api/service/IAlertCalledService.java
+3
-1
TzsAuthService.java
...join/amos/boot/module/tzs/api/service/TzsAuthService.java
+4
-0
AlertCalledMapper.xml
...e-tzs-api/src/main/resources/mapper/AlertCalledMapper.xml
+19
-4
AlertCalledController.java
...boot/module/tzs/biz/controller/AlertCalledController.java
+7
-2
SpecialEquipmentController.java
...module/tzs/biz/controller/SpecialEquipmentController.java
+120
-0
TzsAuthController.java
...mos/boot/module/tzs/biz/controller/TzsAuthController.java
+2
-67
AlertCalledServiceImpl.java
...t/module/tzs/biz/service/impl/AlertCalledServiceImpl.java
+9
-6
ESElevatorServiceImpl.java
...ot/module/tzs/biz/service/impl/ESElevatorServiceImpl.java
+36
-1
TzsAuthServiceImpl.java
.../boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
+79
-0
VoiceRecordFileServiceImpl.java
...dule/tzs/biz/service/impl/VoiceRecordFileServiceImpl.java
+9
-63
AmosTzsApplication.java
...zs/src/main/java/com/yeejoin/amos/AmosTzsApplication.java
+2
-0
application-dev.properties
...-system-tzs/src/main/resources/application-dev.properties
+4
-2
application-qa.properties
...t-system-tzs/src/main/resources/application-qa.properties
+2
-0
application.properties
...boot-system-tzs/src/main/resources/application.properties
+1
-1
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/dto/EsSpecialEquipmentDto.java
View file @
2fc0d704
...
...
@@ -62,5 +62,8 @@ public class EsSpecialEquipmentDto {
@ApiModelProperty
(
value
=
"聚合精确度1-12"
)
private
Integer
precision
;
@ApiModelProperty
(
value
=
"后台聚合查询种类"
)
private
String
selectType
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
View file @
2fc0d704
...
...
@@ -51,4 +51,7 @@ public class SpecialEquipmentDto {
@ApiModelProperty
(
value
=
"设备类别编码"
)
private
String
categoryCode
;
@ApiModelProperty
(
value
=
"内部编码"
)
private
String
innerNum
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/EsElevator.java
View file @
2fc0d704
...
...
@@ -83,4 +83,10 @@ public class EsElevator {
@Field
(
type
=
FieldType
.
Text
,
searchAnalyzer
=
"ik_max_word"
,
analyzer
=
"ik_max_word"
)
private
String
address
;
/**
* 内部编码
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
innerNum
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/mapper/AlertCalledMapper.java
View file @
2fc0d704
...
...
@@ -104,5 +104,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
List
<
AlertPaperInfoDto
>
getAlertPaperInfoList
(
@Param
(
"regionCodes"
)
List
<
String
>
regionCodes
,
@Param
(
"isHistory"
)
Boolean
isHistory
);
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
@Param
(
"regionCodes"
)
List
<
String
>
regionCodes
,
@Param
(
"equipmentClassCode"
)
String
equipmentClassCode
,
@Param
(
"current"
)
Integer
current
,
@Param
(
"equipmentCode"
)
String
equipmentCode
);
Integer
getEquipmentHistoryCount
(
@Param
(
"regionCodes"
)
List
<
String
>
regionCodes
,
@Param
(
"equipmentClassCode"
)
String
equipmentClassCode
,
@Param
(
"equipmentCode"
)
String
equipmentCode
);
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
@Param
(
"regionCodes"
)
List
<
String
>
regionCodes
,
@Param
(
"equipmentClassCode"
)
String
equipmentClassCode
,
@Param
(
"current"
)
Integer
current
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"equipmentCode"
)
String
equipmentCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/service/IAlertCalledService.java
View file @
2fc0d704
...
...
@@ -101,5 +101,7 @@ public interface IAlertCalledService {
*/
List
<
DutySeatDto
>
getSeatInfos
();
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
Integer
pageNum
,
String
equipmentCode
);
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
Integer
current
,
Integer
pageNum
,
String
equipmentCode
);
Integer
getEquipmentHistoryCount
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
String
equipmentCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/service/TzsAuthService.java
View file @
2fc0d704
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
service
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
java.util.List
;
/**
...
...
@@ -9,4 +11,6 @@ import java.util.List;
public
interface
TzsAuthService
{
List
<
String
>
getUserRegionCode
();
List
<
RegionModel
>
getUserReginTree
();
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/AlertCalledMapper.xml
View file @
2fc0d704
...
...
@@ -592,15 +592,30 @@
</foreach>
</if>
order by a.call_time desc
limit #{current} ,#{pageNum}
</select>
<select
id=
"getEquipmentHistoryCount"
resultType=
"java.lang.Integer"
>
SELECT
count(a.sequence_nbr)
FROM tz_alert_called a
<choose>
<when
test=
"current == null "
>
limit 0,3
<when
test=
"equipmentClassCode == '3000'"
>
LEFT JOIN tcb_elevator e ON e.sequence_nbr = a.equipment_id and a.equipment_classification_code = #{equipmentClassCode}
LEFT JOIN tz_dispatch_paper p ON p.alert_id = a.sequence_nbr
where a.is_delete = 0 AND a.alert_status = 1 AND e.rescue_code = #{equipmentCode}
</when>
<otherwise>
limit #{current},5
AND a.alert_status = 0
</otherwise>
</choose>
<if
test=
"regionCodes != null"
>
AND
<foreach
collection=
"regionCodes"
index=
"index"
item=
"item"
open=
"("
separator=
" OR "
close=
")"
>
a.region_code LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
</select>
</mapper>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/AlertCalledController.java
View file @
2fc0d704
...
...
@@ -27,6 +27,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import
com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.ExportDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
...
...
@@ -767,12 +768,16 @@ public class AlertCalledController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getElevatorHistory/{equipmentCode}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取电梯历史事件"
,
notes
=
"获取电梯历史事件"
)
public
ResponseModel
<
List
<
AlertPaperInfoDto
>>
getEquipmentHistory
(
@PathVariable
String
equipmentCode
,
@RequestParam
(
value
=
"pageNum"
,
required
=
false
)
Integer
pageNum
)
{
public
ResponseModel
<
Page
<
AlertPaperInfoDto
>>
getEquipmentHistory
(
@PathVariable
String
equipmentCode
,
@RequestParam
(
value
=
"size"
)
Integer
size
,
@RequestParam
(
value
=
"current"
)
Integer
current
)
{
// 警情id 警情地址 警情状态 警情类型 警情发生时间
// 获取自己的regionCode
String
equipmentClassCode
=
"3000"
;
Page
<
AlertPaperInfoDto
>
result
=
new
Page
<>(
current
,
size
);
List
<
String
>
useRegionCode
=
tzsAuthService
.
getUserRegionCode
();
return
ResponseHelper
.
buildResponse
(
iAlertCalledService
.
getEquipmentHistory
(
useRegionCode
,
equipmentClassCode
,
pageNum
,
equipmentCode
));
List
<
AlertPaperInfoDto
>
list
=
iAlertCalledService
.
getEquipmentHistory
(
useRegionCode
,
equipmentClassCode
,
current
,
size
,
equipmentCode
);
result
.
setRecords
(
list
);
result
.
setTotal
(
iAlertCalledService
.
getEquipmentHistoryCount
(
useRegionCode
,
equipmentClassCode
,
equipmentCode
));
return
ResponseHelper
.
buildResponse
(
result
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/SpecialEquipmentController.java
View file @
2fc0d704
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -22,17 +23,22 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentDto;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentListDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentRegionNum
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentRegionNumServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.MaintainInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.TestInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -100,6 +106,12 @@ public class SpecialEquipmentController extends BaseController {
@Autowired
private
IElevatorRelationService
elevatorRelationService
;
@Autowired
TzsAuthService
tzsAuthService
;
@Autowired
EquipmentRegionNumServiceImpl
equipmentRegionNumServiceImpl
;
/**
* ES查询特种设备信息 带分页 加经纬度过滤 keyword 搜索
...
...
@@ -201,5 +213,113 @@ public class SpecialEquipmentController extends BaseController {
}
/***
* 查询八大类聚合总数
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/queryEquipNumByType"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"查询八大类聚合总数"
,
notes
=
"查询八大类聚合总数"
)
public
ResponseModel
<
List
<
Map
<
String
,
String
>>>
queryEquipNumByType
(
@RequestBody
EsSpecialEquipmentDto
esSpecialEquipmentDto
){
if
(
ValidationUtil
.
isEmpty
(
esSpecialEquipmentDto
.
getSelectType
())
||
ValidationUtil
.
isEmpty
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<>();
List
<
RegionModel
>
userTree
=
tzsAuthService
.
getUserReginTree
();
// 树为省市县
RegionModel
province
=
userTree
.
get
(
0
);
if
(
"0"
.
equals
(
esSpecialEquipmentDto
.
getSelectType
()))
{
// 获取省聚合
List
<
EquipmentRegionNum
>
list
=
equipmentRegionNumServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentRegionNum
>().
eq
(
EquipmentRegionNum:
:
getProvinceCode
,
province
.
getRegionCode
()).
eq
(
EquipmentRegionNum:
:
getCategoryCode
,
esSpecialEquipmentDto
.
getCategoryCode
()));
Long
count
=
0
l
;
for
(
EquipmentRegionNum
t
:
list
)
{
count
+=
t
.
getNum
();
}
Map
<
String
,
String
>
tepMap
=
new
HashMap
<>();
tepMap
.
put
(
"number"
,
count
+
""
);
tepMap
.
put
(
"lat"
,
province
.
getLatitude
());
tepMap
.
put
(
"lon"
,
province
.
getLongitude
());
tepMap
.
put
(
"label"
,
province
.
getRegionName
());
result
.
add
(
tepMap
);
}
else
if
(
"1"
.
equals
(
esSpecialEquipmentDto
.
getSelectType
()))
{
// 获取市聚合
List
<
RegionModel
>
citys
=
(
List
<
RegionModel
>)
province
.
getChildren
();
citys
.
stream
().
forEach
(
c
->
{
List
<
EquipmentRegionNum
>
list
=
equipmentRegionNumServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentRegionNum
>().
eq
(
EquipmentRegionNum:
:
getCityCode
,
c
.
getRegionCode
()).
eq
(
EquipmentRegionNum:
:
getCategoryCode
,
esSpecialEquipmentDto
.
getCategoryCode
()));
Long
count
=
0
l
;
for
(
EquipmentRegionNum
t
:
list
)
{
count
+=
t
.
getNum
();
}
Map
<
String
,
String
>
tepMap
=
new
HashMap
<>();
tepMap
.
put
(
"number"
,
count
+
""
);
tepMap
.
put
(
"lat"
,
c
.
getLatitude
());
tepMap
.
put
(
"lon"
,
c
.
getLongitude
());
tepMap
.
put
(
"label"
,
c
.
getRegionName
());
result
.
add
(
tepMap
);
});
}
else
if
(
"2"
.
equals
(
esSpecialEquipmentDto
.
getSelectType
()))
{
// 获取县聚合
List
<
RegionModel
>
citys
=
(
List
<
RegionModel
>)
province
.
getChildren
();
citys
.
stream
().
forEach
(
c
->
{
List
<
RegionModel
>
districts
=
(
List
<
RegionModel
>)
c
.
getChildren
();
districts
.
stream
().
forEach
(
d
->
{
List
<
EquipmentRegionNum
>
list
=
equipmentRegionNumServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentRegionNum
>().
eq
(
EquipmentRegionNum:
:
getDistrictCode
,
d
.
getRegionCode
()).
eq
(
EquipmentRegionNum:
:
getCategoryCode
,
esSpecialEquipmentDto
.
getCategoryCode
()));
Long
count
=
0
l
;
for
(
EquipmentRegionNum
t
:
list
)
{
count
+=
t
.
getNum
();
}
Map
<
String
,
String
>
tepMap
=
new
HashMap
<>();
tepMap
.
put
(
"number"
,
count
+
""
);
tepMap
.
put
(
"lat"
,
d
.
getLatitude
());
tepMap
.
put
(
"lon"
,
d
.
getLongitude
());
tepMap
.
put
(
"label"
,
d
.
getRegionName
());
result
.
add
(
tepMap
);
});
});
}
return
ResponseHelper
.
buildResponse
(
result
);
}
/***
* 初始化设备
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/initEquipment"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"初始化设备"
,
notes
=
"初始化设备"
)
public
void
initEquipment
(
Integer
num
){
IPage
<
Elevator
>
elevatorPage
=
new
Page
<>();
List
<
RegionModel
>
tree
=
(
List
<
RegionModel
>)
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
// 按照最低级来查询数量 保存地址
RegionModel
start
=
tree
.
get
(
0
);
// 省
List
<
RegionModel
>
city
=
(
List
<
RegionModel
>)
start
.
getChildren
();
city
.
stream
().
forEach
(
c
->
{
List
<
RegionModel
>
district
=
(
List
<
RegionModel
>)
c
.
getChildren
();
district
.
stream
().
forEach
(
d
->
{
List
<
Elevator
>
list
=
elevatorService
.
list
(
new
LambdaQueryWrapper
<
Elevator
>().
eq
(
Elevator:
:
getIsDelete
,
false
).
like
(
Elevator:
:
getRegionCode
,
d
.
getRegionCode
()));
EquipmentRegionNum
temp
=
new
EquipmentRegionNum
();
temp
.
setCategoryCode
(
"3000"
);
temp
.
setCityCode
(
c
.
getRegionCode
()+
""
);
temp
.
setDistrictCode
(
d
.
getRegionCode
()+
""
);
temp
.
setProvinceCode
(
start
.
getRegionCode
()+
""
);
temp
.
setLatitude
(
d
.
getLatitude
());
temp
.
setLongitude
(
d
.
getLongitude
());
temp
.
setNum
((
long
)
list
.
size
());
equipmentRegionNumServiceImpl
.
save
(
temp
);
});
});
}
private
void
setMap
(
Map
<
Integer
,
RegionModel
>
tempMap
,
RegionModel
start
)
{
tempMap
.
put
(
start
.
getRegionCode
(),
start
);
if
(
start
.
getChildren
()
!=
null
)
{
List
<
RegionModel
>
children
=
(
List
<
RegionModel
>)
start
.
getChildren
();
for
(
RegionModel
temp
:
children
)
{
setMap
(
tempMap
,
temp
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/TzsAuthController.java
View file @
2fc0d704
...
...
@@ -74,75 +74,10 @@ public class TzsAuthController extends BaseController {
@GetMapping
(
value
=
"/getUserReginTree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取用户组织机构树"
,
notes
=
"获取用户组织机构树"
)
public
ResponseModel
<
Collection
<
RegionModel
>>
getUserReginTree
()
{
List
<
String
>
regionList
=
tzsAuthService
.
getUserRegionCode
();
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
List
<
RegionModel
>
tree
=
(
List
<
RegionModel
>)
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
// 循环list 将List 封装为 省市区 SET
Set
<
String
>
city
=
new
HashSet
<>();
Set
<
String
>
district
=
new
HashSet
<>();
for
(
String
regionCode
:
regionList
)
{
// 判断是否是某个县
String
districtCode
=
regionCode
.
substring
(
4
,
6
);
if
(
"00"
.
equals
(
districtCode
))
{
// 为市
city
.
add
(
regionCode
);
}
else
{
// 为区
district
.
add
(
regionCode
);
}
}
// 判断市区是否存在区域码的市,如果存在则移除区
Iterator
<
String
>
disIt
=
district
.
iterator
();
while
(
disIt
.
hasNext
())
{
String
regionCode
=
disIt
.
next
();
String
tempCity
=
regionCode
.
substring
(
0
,
4
)
+
"00"
;
if
(
city
.
contains
(
tempCity
))
{
disIt
.
remove
();
}
}
// 将tree 转换为K-V形式便于处理
Map
<
Integer
,
RegionModel
>
tempMap
=
new
HashMap
<
Integer
,
RegionModel
>();
RegionModel
start
=
tree
.
get
(
0
);
// 省
setMap
(
tempMap
,
start
);
List
<
RegionModel
>
newTree
=
new
ArrayList
<
RegionModel
>();
List
<
RegionModel
>
newCity
=
new
ArrayList
<
RegionModel
>();
// 如果管理市 取得整个市的数据 如果管理某个县 取得某市某县数据
Map
<
String
,
RegionModel
>
tempCityMap
=
new
HashMap
<
String
,
RegionModel
>();
for
(
String
regionCode
:
district
)
{
// 先拿市 再封装新的城市
String
cityCode
=
regionCode
.
substring
(
0
,
4
)
+
"00"
;
RegionModel
tempCity
=
tempCityMap
.
get
(
cityCode
);
if
(
tempCity
==
null
)
{
List
<
RegionModel
>
tempDisList
=
new
ArrayList
<
RegionModel
>();
tempDisList
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
tempCity
=
tempMap
.
get
(
Integer
.
parseInt
(
cityCode
));
tempCity
.
setChildren
(
tempDisList
);
tempCityMap
.
put
(
cityCode
,
tempCity
);
}
else
{
List
<
RegionModel
>
tempDisList
=
(
List
<
RegionModel
>)
tempCity
.
getChildren
();
tempDisList
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
}
}
for
(
String
regionCode
:
city
)
{
// 获取城市
newCity
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
}
// 拼接城市
for
(
Map
.
Entry
<
String
,
RegionModel
>
entries
:
tempCityMap
.
entrySet
())
{
newCity
.
add
(
entries
.
getValue
());
}
start
.
setChildren
(
newCity
);
newTree
.
add
(
start
);
return
ResponseHelper
.
buildResponse
(
newTree
);
List
<
RegionModel
>
result
=
tzsAuthService
.
getUserReginTree
();
return
ResponseHelper
.
buildResponse
(
result
);
}
private
void
setMap
(
Map
<
Integer
,
RegionModel
>
tempMap
,
RegionModel
start
)
{
tempMap
.
put
(
start
.
getRegionCode
(),
start
);
if
(
start
.
getChildren
()
!=
null
)
{
List
<
RegionModel
>
children
=
(
List
<
RegionModel
>)
start
.
getChildren
();
for
(
RegionModel
temp
:
children
)
{
setMap
(
tempMap
,
temp
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/AlertCalledServiceImpl.java
View file @
2fc0d704
...
...
@@ -684,12 +684,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
@Override
public
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
List
<
String
>
regionCodes
,
String
equipmentClassCode
,
Integer
pageNum
,
String
equipmentCode
)
{
Integer
current
=
null
;
if
(
pageNum
!=
null
)
{
current
=
3
+(
5
*
pageNum
);
}
List
<
AlertPaperInfoDto
>
temp
=
baseMapper
.
getEquipmentHistory
(
regionCodes
,
equipmentClassCode
,
current
,
equipmentCode
);
public
List
<
AlertPaperInfoDto
>
getEquipmentHistory
(
List
<
String
>
regionCodes
,
String
equipmentClassCode
,
Integer
current
,
Integer
pageNum
,
String
equipmentCode
)
{
current
=
pageNum
*
(
current
-
1
);
List
<
AlertPaperInfoDto
>
temp
=
baseMapper
.
getEquipmentHistory
(
regionCodes
,
equipmentClassCode
,
current
,
pageNum
,
equipmentCode
);
return
temp
;
}
@Override
public
Integer
getEquipmentHistoryCount
(
List
<
String
>
useRegionCode
,
String
equipmentClassCode
,
String
equipmentCode
)
{
return
baseMapper
.
getEquipmentHistoryCount
(
useRegionCode
,
equipmentClassCode
,
equipmentCode
);
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/ESElevatorServiceImpl.java
View file @
2fc0d704
...
...
@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EsElevator
;
import
com.yeejoin.amos.boot.module.tzs.biz.dao.ESElavtorRepository
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.common.geo.GeoBoundingBox
;
...
...
@@ -32,6 +33,7 @@ import org.elasticsearch.search.aggregations.bucket.geogrid.ParsedGeoHashGridBuc
import
org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms
;
import
org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -109,6 +111,7 @@ public class ESElevatorServiceImpl {
esElevator
.
setRescueCode
(
elevator
.
getRescueCode
().
toString
());
esElevator
.
setRegisterCode
(
elevator
.
getRegisterCode
());
esElevator
.
setSequenceNbr
(
elevator
.
getSequenceNbr
());
esElevator
.
setInnerNum
(
elevator
.
getInnerNum
());
if
(
StringUtils
.
isNotBlank
(
elevator
.
getLatitude
())
&&
StringUtils
.
isNotBlank
(
elevator
.
getLongitude
()))
{
Double
lat
=
Double
.
parseDouble
(
elevator
.
getLatitude
());
Double
lon
=
Double
.
parseDouble
(
elevator
.
getLongitude
());
...
...
@@ -452,7 +455,7 @@ public class ESElevatorServiceImpl {
// 创建查询构造器
NativeSearchQuery
query
=
new
NativeSearchQueryBuilder
()
// 分页
.
withPageable
(
PageRequest
.
of
(
current
,
size
))
.
withPageable
(
PageRequest
.
of
(
current
-
1
,
size
))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
...
...
@@ -545,4 +548,36 @@ public class ESElevatorServiceImpl {
}
public
Map
<
String
,
Long
>
queryNumberByRegionCode
(
Map
<
String
,
RegionModel
>
regions
)
{
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
for
(
Map
.
Entry
<
String
,
RegionModel
>
temp:
regions
.
entrySet
())
{
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
filter
(
QueryBuilders
.
matchPhraseQuery
(
"regionCode"
,
temp
.
getKey
()));
boolMust
.
should
(
qb2
);
}
boolMust
.
minimumShouldMatch
(
1
);
TermsAggregationBuilder
termsAggregationBuilder
=
AggregationBuilders
.
terms
(
"number"
).
field
(
"regionCode"
);
// 创建查询构造器
NativeSearchQueryBuilder
queryBuilder
=
new
NativeSearchQueryBuilder
()
// 分页
// .withPageable(PageRequest.of(current, size))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.
withQuery
(
boolMust
).
addAggregation
(
termsAggregationBuilder
);
SearchHits
<
EsElevator
>
searchHits
=
elasticsearchTemplate
.
search
(
queryBuilder
.
build
(),
EsElevator
.
class
);
Aggregations
aggregations
=
searchHits
.
getAggregations
();
Terms
aggregation
=
aggregations
.
get
(
"number"
);
Map
<
String
,
Long
>
result
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
aggregation
.
getBuckets
())
{
result
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
return
result
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
View file @
2fc0d704
...
...
@@ -40,6 +40,8 @@ import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
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.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -54,9 +56,12 @@ import java.util.ArrayList;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -76,4 +81,77 @@ public class TzsAuthServiceImpl implements TzsAuthService {
regionList
.
add
(
"610822"
);
return
regionList
;
}
@Override
public
List
<
RegionModel
>
getUserReginTree
()
{
List
<
String
>
regionList
=
this
.
getUserRegionCode
();
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
List
<
RegionModel
>
tree
=
(
List
<
RegionModel
>)
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
// 循环list 将List 封装为 省市区 SET
Set
<
String
>
city
=
new
HashSet
<>();
Set
<
String
>
district
=
new
HashSet
<>();
for
(
String
regionCode
:
regionList
)
{
// 判断是否是某个县
String
districtCode
=
regionCode
.
substring
(
4
,
6
);
if
(
"00"
.
equals
(
districtCode
))
{
// 为市
city
.
add
(
regionCode
);
}
else
{
// 为区
district
.
add
(
regionCode
);
}
}
// 判断市区是否存在区域码的市,如果存在则移除区
Iterator
<
String
>
disIt
=
district
.
iterator
();
while
(
disIt
.
hasNext
())
{
String
regionCode
=
disIt
.
next
();
String
tempCity
=
regionCode
.
substring
(
0
,
4
)
+
"00"
;
if
(
city
.
contains
(
tempCity
))
{
disIt
.
remove
();
}
}
// 将tree 转换为K-V形式便于处理
Map
<
Integer
,
RegionModel
>
tempMap
=
new
HashMap
<
Integer
,
RegionModel
>();
RegionModel
start
=
tree
.
get
(
0
);
// 省
setMap
(
tempMap
,
start
);
List
<
RegionModel
>
newTree
=
new
ArrayList
<
RegionModel
>();
List
<
RegionModel
>
newCity
=
new
ArrayList
<
RegionModel
>();
// 如果管理市 取得整个市的数据 如果管理某个县 取得某市某县数据
Map
<
String
,
RegionModel
>
tempCityMap
=
new
HashMap
<
String
,
RegionModel
>();
for
(
String
regionCode
:
district
)
{
// 先拿市 再封装新的城市
String
cityCode
=
regionCode
.
substring
(
0
,
4
)
+
"00"
;
RegionModel
tempCity
=
tempCityMap
.
get
(
cityCode
);
if
(
tempCity
==
null
)
{
List
<
RegionModel
>
tempDisList
=
new
ArrayList
<
RegionModel
>();
tempDisList
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
tempCity
=
tempMap
.
get
(
Integer
.
parseInt
(
cityCode
));
tempCity
.
setChildren
(
tempDisList
);
tempCityMap
.
put
(
cityCode
,
tempCity
);
}
else
{
List
<
RegionModel
>
tempDisList
=
(
List
<
RegionModel
>)
tempCity
.
getChildren
();
tempDisList
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
}
}
for
(
String
regionCode
:
city
)
{
// 获取城市
newCity
.
add
(
tempMap
.
get
(
Integer
.
parseInt
(
regionCode
)));
}
// 拼接城市
for
(
Map
.
Entry
<
String
,
RegionModel
>
entries
:
tempCityMap
.
entrySet
())
{
newCity
.
add
(
entries
.
getValue
());
}
start
.
setChildren
(
newCity
);
newTree
.
add
(
start
);
return
newTree
;
}
private
void
setMap
(
Map
<
Integer
,
RegionModel
>
tempMap
,
RegionModel
start
)
{
tempMap
.
put
(
start
.
getRegionCode
(),
start
);
if
(
start
.
getChildren
()
!=
null
)
{
List
<
RegionModel
>
children
=
(
List
<
RegionModel
>)
start
.
getChildren
();
for
(
RegionModel
temp
:
children
)
{
setMap
(
tempMap
,
temp
);
}
}
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/VoiceRecordFileServiceImpl.java
View file @
2fc0d704
...
...
@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordLog
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.ICtiService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IVoiceRecordFileService
;
...
...
@@ -38,7 +39,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
@Autowired
private
VoiceRecordFileServiceImpl
voiceRecordFileServiceImpl
;
private
final
Logger
logger
=
LogManager
.
getLogger
(
AmosFeignService
.
class
);
private
final
Logger
logger
=
LogManager
.
getLogger
(
VoiceRecordFileServiceImpl
.
class
);
@Autowired
AlertCalledServiceImpl
iAlertCalledService
;
...
...
@@ -51,7 +52,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
@Autowired
EmqKeeper
emqKeeper
;
private
String
ctiMessage
=
"/cti/callphone"
;
@Autowired
VoiceRecordLogServiceImpl
iVoiceRecordLogServiceImpl
;
/**
* 分页查询
...
...
@@ -71,67 +73,11 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
@Override
public
void
publishRecord
(
final
VoiceRecordFileDto
model
)
{
Long
now
=
System
.
currentTimeMillis
();
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Long
end
=
System
.
currentTimeMillis
();
// 获取通话人信息
ctiInfos
=
ctiService
.
getCallInfo
(
model
.
getConnectId
());
if
(
ctiInfos
==
null
||
ctiInfos
.
size
()
==
0
)
{
logger
.
error
(
"未找到通话详单信息"
+
(
end
-
now
));
}
JSONObject
recordInfo
=
ctiInfos
.
getJSONObject
(
0
);
model
.
setTel
(
recordInfo
.
getString
(
"telephone"
));
Date
telStartTime
=
null
;
Date
telEndTime
=
null
;
try
{
telStartTime
=
DateUtils
.
longStr2Date
(
recordInfo
.
getString
(
"connectTime"
));
telEndTime
=
DateUtils
.
longStr2Date
(
recordInfo
.
getString
(
"hangupTime"
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"日期转换错误"
);
}
int
times
=
recordInfo
.
getIntValue
(
"times"
);
model
.
setTelTime
(
DateUtils
.
secondsToTimeStr
(
times
));
model
.
setTelStartTime
(
telStartTime
);
model
.
setTelEndTime
(
telEndTime
);
if
(
1
==
recordInfo
.
getInteger
(
"callType"
))
{
model
.
setFileType
(
"客户呼入"
);
}
else
if
(
2
==
recordInfo
.
getInteger
(
"callType"
))
{
model
.
setFileType
(
"坐席呼出"
);
}
Map
<
String
,
String
>
downloadFile
=
ctiService
.
downLoadRecordFile
(
recordInfo
.
getString
(
"connectionid"
));
if
(
downloadFile
.
isEmpty
())
{
logger
.
error
(
"未找到附件文件"
);
}
for
(
Map
.
Entry
<
String
,
String
>
file
:
downloadFile
.
entrySet
())
{
model
.
setFilePath
(
file
.
getKey
());
}
AlertCalledFormDto
alertDto
=
iAlertCalledService
.
selectAlertCalledByIdNoCache
(
model
.
getAlertId
());
if
(
alertDto
==
null
||
alertDto
.
getAlertCalledDto
()
==
null
)
{
logger
.
error
(
"未找到相关警情"
);
}
model
.
setAlertStage
(
alertDto
.
getAlertCalledDto
().
getAlertStage
());
model
.
setAlertStageCode
(
alertDto
.
getAlertCalledDto
().
getAlertStageCode
());
model
.
setSourceId
(-
1
l
);
voiceRecordFileServiceImpl
.
createWithModel
(
model
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"code"
,
"1001"
);
json
.
put
(
"type"
,
"addRecord"
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
ctiMessage
,
json
.
toJSONString
().
getBytes
(),
2
,
false
);
}
catch
(
MqttException
e
)
{
logger
.
error
(
"推送失败"
);
}
// 保存到日志表中
VoiceRecordLog
log
=
new
VoiceRecordLog
();
log
.
setAlertId
(
model
.
getAlertId
());
log
.
setConnectId
(
model
.
getConnectId
());
iVoiceRecordLogServiceImpl
.
save
(
log
);
}
@Override
...
...
amos-boot-system-tzs/src/main/java/com/yeejoin/amos/AmosTzsApplication.java
View file @
2fc0d704
...
...
@@ -16,6 +16,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.core.env.Environment
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
java.net.InetAddress
;
...
...
@@ -36,6 +37,7 @@ import java.net.UnknownHostException;
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@EnableScheduling
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
...
...
amos-boot-system-tzs/src/main/resources/application-dev.properties
View file @
2fc0d704
...
...
@@ -69,4 +69,6 @@ mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push
=
/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push
=
/tzs/tcb_alertMatrix
\ No newline at end of file
mqtt.topic.alertMatrix.push
=
/tzs/tcb_alertMatrix
mqtt.topic.cti.push
=
/cti/record
\ No newline at end of file
amos-boot-system-tzs/src/main/resources/application-qa.properties
View file @
2fc0d704
...
...
@@ -75,3 +75,5 @@ mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push
=
/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push
=
/tzs/tcb_alertMatrix
mqtt.topic.cti.push
=
/cti/record
amos-boot-system-tzs/src/main/resources/application.properties
View file @
2fc0d704
spring.application.name
=
TZS
-kfm
spring.application.name
=
TZS
server.servlet.context-path
=
/tzs
server.port
=
11000
spring.profiles.active
=
dev
...
...
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