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
d9eb09cf
Commit
d9eb09cf
authored
Aug 20, 2024
by
taabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
96333大屏统计接口移至statistics服务
parent
cf4d521e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
317 additions
and
0 deletions
+317
-0
pom.xml
...module-statistics/amos-boot-module-statistics-api/pom.xml
+5
-0
EmergencyBizController.java
...dule/statistcs/biz/controller/EmergencyBizController.java
+39
-0
EmergencyBizServiceImpl.java
...e/statistcs/biz/service/impl/EmergencyBizServiceImpl.java
+196
-0
JsonUtils.java
...ejoin/amos/boot/module/statistcs/biz/utils/JsonUtils.java
+14
-0
emergencyInformation.json
...ics-biz/src/main/resources/json/emergencyInformation.json
+63
-0
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/pom.xml
View file @
d9eb09cf
...
@@ -22,6 +22,11 @@
...
@@ -22,6 +22,11 @@
<artifactId>
amos-boot-module-jg-api
</artifactId>
<artifactId>
amos-boot-module-jg-api
</artifactId>
<version>
${amos-boot-biz.version}
</version>
<version>
${amos-boot-biz.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-96333-api
</artifactId>
<version>
${amos-boot-biz.version}
</version>
</dependency>
</dependencies>
</dependencies>
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/EmergencyBizController.java
0 → 100644
View file @
d9eb09cf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.EmergencyBizServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
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
;
@RestController
@RequestMapping
(
value
=
"/dp/biz/emergency"
)
@Api
(
tags
=
"大屏-应急-业务API"
)
public
class
EmergencyBizController
{
private
EmergencyBizServiceImpl
emergencyBizService
;
public
EmergencyBizController
(
EmergencyBizServiceImpl
emergencyBizService
)
{
this
.
emergencyBizService
=
emergencyBizService
;
}
/**
* 应急大屏使用
*
* @param id 主键
* @return Object
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/detail/{id}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id获取应急事件详细信息"
,
notes
=
"根据id获取应急事件详细信息"
)
public
ResponseModel
<
Object
>
getDetail
(
@PathVariable
Long
id
)
{
return
ResponseHelper
.
buildResponse
(
emergencyBizService
.
getDetail
(
id
));
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/EmergencyBizServiceImpl.java
0 → 100644
View file @
d9eb09cf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.FormValue
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.VoiceRecordFile
;
import
com.yeejoin.amos.boot.module.elevator.api.mapper.*
;
import
com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledDto
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledFormDto
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.RepairConsult
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Service
public
class
EmergencyBizServiceImpl
{
@Value
(
"classpath:/json/emergencyInformation.json"
)
private
Resource
emergencyInformation
;
@Autowired
public
EmergencyBizServiceImpl
(
ElevatorMapper
elevatorMapper
,
AlertCalledMapper
alertCalledMapper
,
RepairConsultMapper
repairConsultMapper
,
AlertFormValueMapper
alertFormValueMapper
,
VoiceRecordFileMapper
voiceRecordFileMapper
)
{
this
.
elevatorMapper
=
elevatorMapper
;
this
.
alertCalledMapper
=
alertCalledMapper
;
this
.
repairConsultMapper
=
repairConsultMapper
;
this
.
alertFormValueMapper
=
alertFormValueMapper
;
this
.
voiceRecordFileMapper
=
voiceRecordFileMapper
;
}
private
ElevatorMapper
elevatorMapper
;
private
AlertCalledMapper
alertCalledMapper
;
private
RepairConsultMapper
repairConsultMapper
;
private
AlertFormValueMapper
alertFormValueMapper
;
private
VoiceRecordFileMapper
voiceRecordFileMapper
;
public
Object
getDetail
(
Long
id
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
HashMap
<
String
,
Object
>
keyinfoData
=
new
HashMap
<>();
// 基本信息
List
<
FormValue
>
jsonData
=
JsonUtils
.
getJsonData
(
emergencyInformation
);
AlertCalledFormDto
alertCalledFormVo
=
getAlertCalledFormDto
(
id
);
Map
<
String
,
Object
>
objectMap
=
Bean
.
BeantoMap
(
alertCalledFormVo
.
getAlertCalledDto
());
List
<
FormValue
>
dynamicFormAlert
=
alertCalledFormVo
.
getDynamicFormAlert
();
jsonData
.
forEach
(
f
->
{
Object
o
=
objectMap
.
get
(
f
.
getKey
());
if
(!
ObjectUtils
.
isEmpty
(
o
))
{
f
.
setValue
(
o
.
toString
());
if
(
"callTime"
.
equals
(
f
.
getKey
()))
{
f
.
setValue
(
simpleDateFormat
.
format
(
alertCalledFormVo
.
getAlertCalledDto
().
getCallTime
()));
}
}
});
jsonData
.
addAll
(
dynamicFormAlert
);
// 使用单位信息
// 获取根据警情获取电梯信息
Map
<
String
,
Object
>
map
=
this
.
selectByAlertId
(
id
);
// 根据设备id 获取使用单位信息
Map
<
String
,
Object
>
useUnitMap
=
elevatorMapper
.
selectUseUnitByAlertId
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
)));
if
(!
ObjectUtils
.
isEmpty
(
useUnitMap
))
{
jsonData
.
forEach
(
f
->
{
// 单位名称
if
(
"useUnitName"
.
equals
(
f
.
getKey
()))
{
f
.
setValue
(
ObjectUtils
.
isEmpty
(
useUnitMap
.
get
(
"useUnitName"
))
?
null
:
String
.
valueOf
(
useUnitMap
.
get
(
"useUnitName"
)));
}
// 单位地址
if
(
"unitAddress"
.
equals
(
f
.
getKey
()))
{
f
.
setValue
(
ObjectUtils
.
isEmpty
(
useUnitMap
.
get
(
"address"
))
?
null
:
String
.
valueOf
(
useUnitMap
.
get
(
"address"
)));
}
// 安全管理员
if
(
"securityAdministrator"
.
equals
(
f
.
getKey
()))
{
f
.
setValue
(
ObjectUtils
.
isEmpty
(
useUnitMap
.
get
(
"manager"
))
?
null
:
String
.
valueOf
(
useUnitMap
.
get
(
"manager"
)));
}
// 安全管理员电话
if
(
"securityAdministratorPhone"
.
equals
(
f
.
getKey
()))
{
f
.
setValue
(
ObjectUtils
.
isEmpty
(
useUnitMap
.
get
(
"managerPhone"
))
?
null
:
String
.
valueOf
(
useUnitMap
.
get
(
"managerPhone"
)));
}
});
}
// 处置记录
LambdaQueryWrapper
<
RepairConsult
>
queryWrapper
=
new
LambdaQueryWrapper
<
RepairConsult
>();
queryWrapper
.
eq
(
RepairConsult:
:
getParentId
,
id
).
orderByDesc
(
RepairConsult:
:
getRecDate
);
List
<
RepairConsult
>
list
=
repairConsultMapper
.
selectList
(
queryWrapper
);
HashMap
<
String
,
Object
>
datas
=
new
HashMap
<>();
ArrayList
<
Map
<
String
,
Object
>>
records
=
new
ArrayList
<>();
list
.
forEach
(
r
->
{
HashMap
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"label"
,
r
.
getAlertStatus
());
data
.
put
(
"operatingTime"
,
r
.
getRecDate
());
data
.
put
(
"operater"
,
r
.
getDescription
());
records
.
add
(
data
);
});
// 96333码
HashMap
<
String
,
Object
>
qrcode
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
alertCalledFormVo
.
getAlertCalledDto
()))
{
qrcode
.
put
(
"title"
,
"96333码"
);
qrcode
.
put
(
"value"
,
alertCalledFormVo
.
getAlertCalledDto
().
getDeviceId
());
try
{
String
problemTime
=
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
Y_M_D_HMS
);
qrcode
.
put
(
"text"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"yyyy-MM-dd"
));
qrcode
.
put
(
"subtext"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"HH:mm:ss"
));
String
color
;
if
(
alertCalledFormVo
.
getAlertCalledDto
().
getAlertStatus
())
{
color
=
"green"
;
}
else
{
color
=
"red"
;
}
qrcode
.
put
(
"color"
,
color
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
datas
.
put
(
"datas"
,
records
);
datas
.
put
(
"title"
,
"处置记录"
);
datas
.
put
(
"renderType"
,
"timeline"
);
keyinfoData
.
put
(
"title"
,
ObjectUtils
.
isEmpty
(
useUnitMap
.
get
(
"useUnitName"
))
?
null
:
String
.
valueOf
(
useUnitMap
.
get
(
"useUnitName"
)));
keyinfoData
.
put
(
"keyParams"
,
jsonData
);
keyinfoData
.
put
(
"infoRecords"
,
datas
);
keyinfoData
.
put
(
"qrcode"
,
qrcode
);
return
keyinfoData
;
}
public
AlertCalledFormDto
getAlertCalledFormDto
(
Long
id
)
{
// 警情基本信息
AlertCalled
alertCalled
=
alertCalledMapper
.
selectById
(
id
);
LambdaQueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
AlertFormValue:
:
getAlertCalledId
,
id
);
// 警情动态表单数据
List
<
AlertFormValue
>
list
=
alertFormValueMapper
.
selectList
(
queryWrapper
);
List
<
FormValue
>
formValue
=
new
ArrayList
<
FormValue
>();
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
for
(
AlertFormValue
alertFormValue
:
list
)
{
FormValue
value
=
new
FormValue
(
alertFormValue
.
getFieldCode
(),
alertFormValue
.
getFieldName
(),
"text"
,
alertFormValue
.
getFieldValue
(),
alertFormValue
.
getBlock
());
formValue
.
add
(
value
);
}
}
AlertCalledDto
alertCalledDto
=
new
AlertCalledDto
();
BeanUtils
.
copyProperties
(
alertCalled
,
alertCalledDto
);
Elevator
elevator
=
new
Elevator
();
elevator
.
setRescueCode
(
Integer
.
valueOf
(
alertCalled
.
getDeviceId
()));
elevator
.
setRegisterCode
(
alertCalled
.
getRegistrationCode
());
Map
<
String
,
Object
>
map
=
elevatorMapper
.
selectElevator
(
elevator
);
if
(!
ObjectUtils
.
isEmpty
(
map
))
{
alertCalledDto
.
setAddress
(
String
.
valueOf
(
map
.
get
(
"address"
)));
alertCalledDto
.
setProvince
(
String
.
valueOf
(
map
.
get
(
"province"
)));
alertCalledDto
.
setCity
(
String
.
valueOf
(
map
.
get
(
"city"
)));
alertCalledDto
.
setDistrict
(
String
.
valueOf
(
map
.
get
(
"district"
)));
alertCalledDto
.
setUseStatus
(
String
.
valueOf
(
map
.
get
(
"useStatus"
)));
alertCalledDto
.
setUseSiteCategory
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"useSiteCategory"
))
||
"null"
.
equals
(
String
.
valueOf
(
map
.
get
(
"useSiteCategory"
)))
?
null
:
String
.
valueOf
(
map
.
get
(
"useSiteCategory"
)));
alertCalledDto
.
setUseUnit
(
String
.
valueOf
(
map
.
get
(
"useUnit"
)));
alertCalledDto
.
setRegionCode
(
String
.
valueOf
(
map
.
get
(
"regionCode"
)));
}
String
voiceRecord
=
""
;
VoiceRecordFile
temp
=
voiceRecordFileMapper
.
selectOne
(
new
LambdaQueryWrapper
<
VoiceRecordFile
>().
eq
(
VoiceRecordFile:
:
getAlertId
,
id
).
eq
(
VoiceRecordFile:
:
getAlertStageCode
,
"860"
).
orderByAsc
(
VoiceRecordFile:
:
getTelStartTime
).
last
(
"limit 1"
));
if
(
temp
!=
null
)
{
voiceRecord
=
temp
.
getFilePath
();
}
return
new
AlertCalledFormDto
(
alertCalledDto
,
formValue
,
voiceRecord
);
}
public
Map
<
String
,
Object
>
selectByAlertId
(
Long
alertId
)
{
AlertCalled
alertCalled
=
alertCalledMapper
.
selectById
(
alertId
);
if
(
ValidationUtil
.
isEmpty
(
alertCalled
)
||
ValidationUtil
.
isEmpty
(
alertCalled
.
getDeviceId
()))
{
throw
new
BadRequest
(
"警情不存在或者设备编码不存在"
);
}
// 设备类型 和 编码 确定设备的使用单位或者维保单位
String
equipmentClassificationCode
=
alertCalled
.
getEquipmentClassificationCode
();
String
deviceId
=
alertCalled
.
getEquipmentId
();
// 目前只有电梯类型
Elevator
elevator
=
new
Elevator
();
elevator
.
setOriginalId
(
deviceId
);
Map
<
String
,
Object
>
map
=
elevatorMapper
.
selectElevator
(
elevator
);
if
(
ValidationUtil
.
isEmpty
(
map
))
{
throw
new
BadRequest
(
"设备未找到"
);
}
return
map
;
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/utils/JsonUtils.java
View file @
d9eb09cf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
utils
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.FormValue
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
public
class
JsonUtils
{
public
class
JsonUtils
{
//将json文件转化为Map<list<Map<>>>
//将json文件转化为Map<list<Map<>>>
...
@@ -19,4 +23,14 @@ public class JsonUtils {
...
@@ -19,4 +23,14 @@ public class JsonUtils {
}
}
return
JSONObject
.
parseObject
(
json
,
Map
.
class
);
return
JSONObject
.
parseObject
(
json
,
Map
.
class
);
}
}
public
static
List
<
FormValue
>
getJsonData
(
Resource
resource
)
{
String
json
;
try
{
json
=
IOUtils
.
toString
(
resource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
parseArray
(
json
,
FormValue
.
class
);
}
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/resources/json/emergencyInformation.json
0 → 100644
View file @
d9eb09cf
[
{
"key"
:
"emergencyPerson"
,
"label"
:
"救援人姓名"
,
"type"
:
"text"
},
{
"key"
:
"callTime"
,
"label"
:
"接警时间"
,
"type"
:
"text"
},
{
"key"
:
"contactPhone"
,
"label"
:
"联系人电话"
,
"type"
:
"text"
},
{
"key"
:
"useSiteCategory"
,
"label"
:
"使用场所分类"
,
"type"
:
"text"
},
{
"key"
:
"deviceId"
,
"label"
:
"电梯识别码"
,
"type"
:
"text"
},
{
"key"
:
"useStatus"
,
"label"
:
"使用情况"
,
"type"
:
"text"
},
{
"key"
:
"address"
,
"label"
:
"地址"
,
"type"
:
"text"
},
{
"key"
:
"useUnitName"
,
"label"
:
"使用单位"
,
"type"
:
"text"
},
{
"key"
:
"principalPhone"
,
"label"
:
"单位电话"
,
"type"
:
"text"
},
{
"key"
:
"unitAddress"
,
"label"
:
"单位地址"
,
"type"
:
"text"
},
{
"key"
:
"securityAdministrator"
,
"label"
:
"电梯安全管理员"
,
"type"
:
"text"
},
{
"key"
:
"securityAdministratorPhone"
,
"label"
:
"电梯安全管理员电话"
,
"type"
:
"text"
}
]
\ 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