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
b957dbdd
Commit
b957dbdd
authored
Aug 06, 2021
by
李腾威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日常管理-相似警情及警情统计
parent
e2d0faf0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
167 additions
and
0 deletions
+167
-0
AlertCalledMapper.java
...in/amos/boot/module/tzs/api/mapper/AlertCalledMapper.java
+15
-0
AlarmStatisticsVo.java
...eejoin/amos/boot/module/tzs/api/vo/AlarmStatisticsVo.java
+44
-0
AlertCalledMapper.xml
...e-tzs-api/src/main/resources/mapper/AlertCalledMapper.xml
+24
-0
AlertCalledController.java
...boot/module/tzs/biz/controller/AlertCalledController.java
+62
-0
AlertCalledServiceImpl.java
...t/module/tzs/biz/service/impl/AlertCalledServiceImpl.java
+22
-0
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/mapper/AlertCalledMapper.java
View file @
b957dbdd
...
...
@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Map
;
/**
* 警情接警填报记录 Mapper 接口
...
...
@@ -11,4 +14,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
AlertCalledMapper
extends
BaseMapper
<
AlertCalled
>
{
/**
* 接警情况统计
*
* @param beginDate
* @param endDate
* @return
*/
Map
<
String
,
Integer
>
queryAlertStatusCount
(
@Param
(
"beginDate"
)
String
beginDate
,
@Param
(
"endDate"
)
String
endDate
,
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"recUserId"
)
String
recUserId
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/vo/AlarmStatisticsVo.java
0 → 100644
View file @
b957dbdd
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Map
;
/**
* * 警情统计
* @author fengwang
* @date 2021-08-06.
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"AlarmStatisticsVo"
,
description
=
"AlarmStatisticsVo"
)
public
class
AlarmStatisticsVo
{
@ApiModelProperty
(
value
=
"我的待办数量"
)
private
Integer
todoNum
;
@ApiModelProperty
(
value
=
"今日接警数量"
)
private
Integer
todayAlarmNum
;
@ApiModelProperty
(
value
=
"今日提交数量"
)
private
Integer
submitNum
;
@ApiModelProperty
(
value
=
"全部待办"
)
private
Integer
allNum
;
@ApiModelProperty
(
value
=
"近七天办理数量"
)
private
Map
<
String
,
Integer
>
nearlySevenDaysNum
;
@ApiModelProperty
(
value
=
"故障事件数量"
)
private
Integer
faultRescue
;
@ApiModelProperty
(
value
=
"困人救援数量"
)
private
Integer
sleepyIncident
;
@ApiModelProperty
(
value
=
"投诉建议数量"
)
private
Integer
suggestions
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/AlertCalledMapper.xml
View file @
b957dbdd
...
...
@@ -2,4 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper"
>
<select
id=
"queryAlertStatusCount"
resultType=
"java.util.Map"
>
SELECT
count( 1 ) calledCount,
sum( CASE WHEN father_alert = null THEN 1 ELSE 0 END ) majorAlertCount
sum( CASE WHEN alarm_type_code = 'KRJY' THEN 1 ELSE 0 END ) sleepyIncidentCount
sum( CASE WHEN alarm_type_code = 'GZWX' THEN 1 ELSE 0 END ) faultRescueCount
sum( CASE WHEN alarm_type_code = 'TSZX' l THEN 1 ELSE 0 END ) suggestionsCount
FROM
tz_alert_called
WHERE 1 = 1
<if
test=
"beginDate != null and beginDate != ''"
>
and call_time >= #{beginDate}
</if>
<if
test=
"endDate != null and endDate != ''"
>
and call_time
<![CDATA[ <= ]]>
#{endDate}
</if>
<if
test=
"alarmTypeCode != null and alarmTypeCode != ''"
>
and alarm_type_code = #{alarmTypeCode}
</if>
<if
test=
"orgCode != null and orgCode != '' and recUserId != null and recUserId != ''"
>
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</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 @
b957dbdd
...
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto
;
...
...
@@ -15,6 +17,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.AlarmStatisticsVo
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.AlertCalledVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl
;
...
...
@@ -41,7 +44,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.lang.reflect.Field
;
import
java.text.ParseException
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -135,6 +140,63 @@ public class AlertCalledController extends BaseController {
return
ResponseHelper
.
buildResponse
(
iAlertCalledService
.
selectAlertCalledById
(
id
));
}
/**
* 警情统计
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/alert-statistics"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"警情统计"
,
notes
=
"警情统计"
)
public
ResponseModel
<
AlarmStatisticsVo
>
alertStatistics
()
throws
ParseException
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
null
!=
redisUtils
.
get
(
buildKey
(
getToken
()))
?
redisUtils
.
get
(
buildKey
(
getToken
())).
toString
()
:
null
,
ReginParams
.
class
);
//我的待办数量
QueryWrapper
<
AlertCalled
>
todoNumQueryWrapper
=
new
QueryWrapper
<>();
//全部待办数量
QueryWrapper
<
AlertCalled
>
allNumQueryWrapper
=
new
QueryWrapper
<>();
AlarmStatisticsVo
alarmStatisticsVo
=
new
AlarmStatisticsVo
();
todoNumQueryWrapper
.
eq
(
"alert_status"
,
false
);
allNumQueryWrapper
.
eq
(
"alert_status"
,
false
);
if
(
null
!=
reginParams
)
{
todoNumQueryWrapper
.
eq
(
"rec_user_id"
,
reginParams
.
getUserModel
().
getUserId
());
todoNumQueryWrapper
.
or
(
true
);
todoNumQueryWrapper
.
eq
(
"org_code"
,
reginParams
.
getCompany
().
getOrgCode
());
alarmStatisticsVo
.
setTodoNum
(
iAlertCalledService
.
list
(
todoNumQueryWrapper
).
size
());
alarmStatisticsVo
.
setAllNum
(
iAlertCalledService
.
list
(
allNumQueryWrapper
).
size
());
Map
<
String
,
Object
>
map
=
iAlertCalledService
.
getAlertInfoList
(
DateUtils
.
dateFormat
(
new
Date
(),
""
)+
" 00:00:00"
,
DateUtils
.
dateFormat
(
new
Date
(),
""
)+
" 23:59:59"
,
reginParams
.
getCompany
().
getOrgCode
(),
reginParams
.
getUserModel
().
getUserId
());
// 当天接警
alarmStatisticsVo
.
setTodayAlarmNum
(
map
.
get
(
"calledCount"
)
==
null
?
0
:
Integer
.
valueOf
(
map
.
get
(
"calledCount"
).
toString
()))
;
//当天提交
alarmStatisticsVo
.
setTodayAlarmNum
(
map
.
get
(
"majorAlertCount"
)
==
null
?
0
:
Integer
.
valueOf
(
map
.
get
(
"majorAlertCount"
).
toString
()))
;
//投诉咨询数量
alarmStatisticsVo
.
setSuggestions
(
map
.
get
(
"suggestionsCount"
)
==
null
?
0
:
Integer
.
valueOf
(
map
.
get
(
"suggestionsCount"
).
toString
()))
;
//故障维修数量
alarmStatisticsVo
.
setSuggestions
(
map
.
get
(
"faultRescueCount"
)
==
null
?
0
:
Integer
.
valueOf
(
map
.
get
(
"faultRescueCount"
).
toString
()))
;
//困人救援数量
alarmStatisticsVo
.
setSuggestions
(
map
.
get
(
"sleepyIncidentCount"
)
==
null
?
0
:
Integer
.
valueOf
(
map
.
get
(
"sleepyIncidentCount"
).
toString
()))
;
Map
<
String
,
Integer
>
recordMap
=
Maps
.
newHashMap
();
// 近七天办理数量
for
(
int
i
=
1
;
i
<
8
;
i
++)
{
Map
<
String
,
Object
>
nearlySevenDaysMap
=
iAlertCalledService
.
getAlertInfoList
(
DateUtils
.
dateFormat
(
DateUtils
.
dateAddDays
(
new
Date
(),
-
i
),
""
)+
" 00:00:00"
,
DateUtils
.
dateFormat
(
DateUtils
.
dateAddDays
(
new
Date
(),
-
i
),
""
)+
" 23:59:59"
,
reginParams
.
getCompany
().
getOrgCode
(),
reginParams
.
getUserModel
().
getUserId
());
recordMap
.
put
(
DateUtils
.
dateFormat
(
DateUtils
.
dateAddDays
(
new
Date
(),
-
i
),
""
),
nearlySevenDaysMap
.
get
(
"calledCount"
)
==
null
?
0
:
Integer
.
valueOf
(
nearlySevenDaysMap
.
get
(
"calledCount"
).
toString
()));
}
alarmStatisticsVo
.
setNearlySevenDaysNum
(
recordMap
);
}
return
ResponseHelper
.
buildResponse
(
alarmStatisticsVo
);
}
/**
* 列表分页查询
*
...
...
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 @
b957dbdd
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
...
...
@@ -32,6 +33,7 @@ import java.text.ParseException;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 警情接警填报记录服务实现类
...
...
@@ -63,6 +65,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
private
RepairConsultServiceImpl
repairConsultService
;
@Autowired
AlertCalledMapper
alertCalledMapper
;
private
final
Logger
logger
=
LogManager
.
getLogger
(
AlertCalledServiceImpl
.
class
);
...
...
@@ -224,4 +230,19 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
repairConsult
.
setDescription
(
transferDetails
);
repairConsultService
.
save
(
repairConsult
);
}
public
Map
<
String
,
Object
>
getAlertInfoList
(
String
beginDate
,
String
endDate
,
String
orgCode
,
String
recUserId
)
{
Map
<
String
,
Object
>
result
=
Maps
.
newHashMap
();
Map
<
String
,
Integer
>
statusCountMap
=
alertCalledMapper
.
queryAlertStatusCount
(
beginDate
,
endDate
,
orgCode
,
recUserId
);
result
.
put
(
"calledCount"
,
statusCountMap
.
get
(
"calledCount"
));
result
.
put
(
"majorAlertCount"
,
statusCountMap
.
get
(
"majorAlertCount"
));
result
.
put
(
"sleepyIncidentCount"
,
statusCountMap
.
get
(
"sleepyIncidentCount"
));
result
.
put
(
"faultRescueCount"
,
statusCountMap
.
get
(
"faultRescueCount"
));
result
.
put
(
"suggestionsCount"
,
statusCountMap
.
get
(
"suggestionsCount"
));
return
result
;
}
}
\ 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