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
e8ae9fe8
Commit
e8ae9fe8
authored
Jul 24, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.应急大屏中间地图接口开发
parent
6fa1c822
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
7 deletions
+79
-7
AlertStatisticsMapper.java
...oot/module/elevator/api/mapper/AlertStatisticsMapper.java
+2
-0
AlertStatisticsMapper.xml
...3-api/src/main/resources/mapper/AlertStatisticsMapper.xml
+10
-0
DPStatisticsController.java
...odule/elevator/biz/controller/DPStatisticsController.java
+23
-0
DPStatisticsServiceImpl.java
...le/elevator/biz/service/impl/DPStatisticsServiceImpl.java
+44
-7
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/mapper/AlertStatisticsMapper.java
View file @
e8ae9fe8
...
...
@@ -20,4 +20,6 @@ public interface AlertStatisticsMapper extends BaseMapper<AlertStatistics> {
Long
countProblemByTypeDateAndOrgCode
(
@Param
(
"problemType"
)
String
problemType
,
@Param
(
"dto"
)
DPFilterParamDto
params
,
@Param
(
"orgCode"
)
String
orgCode
);
String
getOrgCodeByCompanyCode
(
String
cityCode
);
Long
countEmergencyEventsByUniBizKey
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
filterParamDto
);
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/resources/mapper/AlertStatisticsMapper.xml
View file @
e8ae9fe8
...
...
@@ -112,4 +112,14 @@
<select
id=
"getOrgCodeByCompanyCode"
resultType=
"java.lang.String"
>
select org_code from privilege_company where company_code = #{companyCode} limit 1
</select>
<select
id=
"countEmergencyEventsByUniBizKey"
resultType=
"java.lang.Long"
>
SELECT
COALESCE(sum(emergency_events),0)
FROM
"tzs_alert_statistics"
where
supervisory_unit_org_code = #{orgCode}
and start_date=#{dto.beginDate}
and end_date=#{dto.endDate}
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/controller/DPStatisticsController.java
View file @
e8ae9fe8
...
...
@@ -105,4 +105,27 @@ public class DPStatisticsController {
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
rankUnitByRescueTime
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-应急-中间地图图列统计"
,
notes
=
"大屏-应急-中间地图图列统计"
)
@PostMapping
(
value
=
"/zl/center-map/legend"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
centerMapCountForGlobal
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForGlobal
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-应急-中间地图地市统计"
,
notes
=
"大屏总览中间-地图地市统计"
)
@PostMapping
(
value
=
"/zl/center-map/overview"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
centerMapCountForOverview
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForOverview
(
dpFilterParamDto
));
}
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/DPStatisticsServiceImpl.java
View file @
e8ae9fe8
...
...
@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
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.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum
;
...
...
@@ -13,21 +12,18 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.AlertMaintenanceUnitStat
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertRescueStatistics
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertUseUnitStatistics
;
import
com.yeejoin.amos.boot.module.elevator.api.mapper.*
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IAlertRescueStatisticsService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.
springframework.beans.factory.annotation.Autowired
;
import
org.
apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.DateTimeUtil
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
...
...
@@ -56,17 +52,20 @@ public class DPStatisticsServiceImpl {
private
AlertMaintenanceUnitStatisticsMapper
alertMaintenanceUnitStatisticsMapper
;
private
AlertStatisticsMapper
alertStatisticsMapper
;
private
static
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
private
static
Map
<
String
,
List
<
RegionModel
>>
regionChildRegionMap
=
new
ConcurrentHashMap
<>();
public
DPStatisticsServiceImpl
(
YjBaseMapper
yjBaseMapper
,
AlertCalledMapper
alertCalledMapper
,
ElevatorMapper
elevatorMapper
,
AlertRescueStatisticsMapper
alertRescueStatisticsMapper
,
AlertUseUnitStatisticsMapper
alertUseUnitStatisticsMapper
,
AlertMaintenanceUnitStatisticsMapper
alertMaintenanceUnitStatisticsMapper
)
{
public
DPStatisticsServiceImpl
(
YjBaseMapper
yjBaseMapper
,
AlertCalledMapper
alertCalledMapper
,
ElevatorMapper
elevatorMapper
,
AlertRescueStatisticsMapper
alertRescueStatisticsMapper
,
AlertUseUnitStatisticsMapper
alertUseUnitStatisticsMapper
,
AlertMaintenanceUnitStatisticsMapper
alertMaintenanceUnitStatisticsMapper
,
AlertStatisticsMapper
alertStatisticsMapper
)
{
this
.
yjBaseMapper
=
yjBaseMapper
;
this
.
alertCalledMapper
=
alertCalledMapper
;
this
.
elevatorMapper
=
elevatorMapper
;
this
.
alertRescueStatisticsMapper
=
alertRescueStatisticsMapper
;
this
.
alertUseUnitStatisticsMapper
=
alertUseUnitStatisticsMapper
;
this
.
alertMaintenanceUnitStatisticsMapper
=
alertMaintenanceUnitStatisticsMapper
;
this
.
alertStatisticsMapper
=
alertStatisticsMapper
;
}
public
JSONObject
eventStatByDay
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
...
...
@@ -253,5 +252,43 @@ public class DPStatisticsServiceImpl {
}
legendData
.
put
(
dataKey
,
value
);
return
jsonObject
;
};
}
public
List
<
Map
<
String
,
Object
>>
getCenterMapCountDataForOverview
(
DPFilterParamDto
dpFilterParamDto
)
{
this
.
setDefaultFilter
(
dpFilterParamDto
);
return
getRegionList
(
dpFilterParamDto
).
parallelStream
().
map
(
r
->
{
DPFilterParamDto
filterParamDto
=
new
DPFilterParamDto
();
filterParamDto
.
setCityCode
(
r
.
getRegionCode
().
toString
());
String
orgCode
=
this
.
getAndSetOrgCode
(
filterParamDto
);
Map
<
String
,
Object
>
itemResult
=
getCenterMapOverviewData
(
orgCode
,
filterParamDto
);
itemResult
.
put
(
"regionCode"
,
r
.
getRegionCode
());
itemResult
.
put
(
"regionName"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
}
private
Map
<
String
,
Object
>
getCenterMapOverviewData
(
String
orgCode
,
DPFilterParamDto
filterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Long
num
=
alertStatisticsMapper
.
countEmergencyEventsByUniBizKey
(
orgCode
,
filterParamDto
);
result
.
put
(
"alarmCount"
,
num
);
return
result
;
}
public
Map
<
String
,
Object
>
getCenterMapCountDataForGlobal
(
DPFilterParamDto
dpFilterParamDto
)
{
this
.
setDefaultFilter
(
dpFilterParamDto
);
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
);
// 1.报检数量统计
return
this
.
getCenterMapOverviewData
(
orgCode
,
dpFilterParamDto
);
}
private
void
setDefaultFilter
(
DPFilterParamDto
dpFilterParamDto
)
{
if
(
StringUtils
.
isEmpty
(
dpFilterParamDto
.
getBeginDate
()))
{
dpFilterParamDto
.
setBeginDate
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
beginOfMonth
(
new
Date
()).
toDateStr
());
}
if
(
StringUtils
.
isEmpty
(
dpFilterParamDto
.
getEndDate
()))
{
dpFilterParamDto
.
setEndDate
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
endOfMonth
(
new
Date
()).
toDateStr
());
}
}
}
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