Commit 33d904d2 authored by tianyiming's avatar tianyiming

96333日常值班统计修改

parent 4f9ff101
...@@ -8,7 +8,8 @@ import lombok.experimental.Accessors; ...@@ -8,7 +8,8 @@ import lombok.experimental.Accessors;
import java.util.Map; import java.util.Map;
/** /**
* * 警情统计 * * 警情统计
*
* @author fengwang * @author fengwang
* @date 2021-08-06. * @date 2021-08-06.
*/ */
...@@ -21,24 +22,24 @@ public class AlarmStatisticsDto { ...@@ -21,24 +22,24 @@ public class AlarmStatisticsDto {
private Integer todoNum; private Integer todoNum;
@ApiModelProperty(value = "今日接警数量") @ApiModelProperty(value = "今日接警数量")
private Integer todayAlarmNum; private Long todayAlarmNum;
@ApiModelProperty(value = "今日提交数量") @ApiModelProperty(value = "今日提交数量")
private Integer submitNum; private Long submitNum;
@ApiModelProperty(value = "全部待办") @ApiModelProperty(value = "全部待办")
private Integer allNum; private Integer allNum;
@ApiModelProperty(value = "近七天办理数量") @ApiModelProperty(value = "近七天办理数量")
private Map<String,Integer> nearlySevenDaysNum; private Map<String, Long> nearlySevenDaysNum;
@ApiModelProperty(value = "故障事件数量") @ApiModelProperty(value = "故障事件数量")
private Integer faultRescue; private Long faultRescue;
@ApiModelProperty(value = "困人救援数量") @ApiModelProperty(value = "困人救援数量")
private Integer sleepyIncident; private Long sleepyIncident;
@ApiModelProperty(value = "投诉建议数量") @ApiModelProperty(value = "投诉建议数量")
private Integer suggestions; private Long suggestions;
} }
...@@ -32,10 +32,9 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -32,10 +32,9 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
* @param endDate * @param endDate
* @return * @return
*/ */
List<Map<String, Integer>> queryNearlyCount(@Param("beginDate") String beginDate, List<Map<String, Object>> queryNearlyCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("orgCode") String orgCode, @Param("groupCode") String groupCode
@Param("recUserId") String recUserId
); );
/** /**
* 接警情况统计 * 接警情况统计
...@@ -44,11 +43,9 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -44,11 +43,9 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
* @param endDate * @param endDate
* @return * @return
*/ */
Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate, Map<String, Long> queryAlertStatusCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("orgCode") String orgCode, @Param("groupCode") String groupCode);
@Param("recUserId") String recUserId
);
/** /**
* 根据查询条件返回警情记录 * 根据查询条件返回警情记录
...@@ -76,7 +73,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -76,7 +73,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
@Param("ids") List<String> ids); @Param("ids") List<String> ids);
Map<String, Integer> getTodayEmergencyCount(String regionCode); Map<String, Integer> getTodayEmergencyCount(String regionCode);
Map<String, Integer> getImportantEventCount(String regionCode); Map<String, Integer> getImportantEventCount(String regionCode);
...@@ -114,4 +111,6 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -114,4 +111,6 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
@Select("select count(1) from tz_alert_called where rec_user_name =#{userName} and rec_date >= #{startTime} and rec_date <= #{endTime}") @Select("select count(1) from tz_alert_called where rec_user_name =#{userName} and rec_date >= #{startTime} and rec_date <= #{endTime}")
Integer getCountNum(String userName, Date startTime, Date endTime); Integer getCountNum(String userName, Date startTime, Date endTime);
Map<String, Long> getMyBacklog(String groupCode);
} }
...@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.elevator.api.service; ...@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.elevator.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.elevator.api.dto.*; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums; import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.elevator.api.dto.*; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
...@@ -99,4 +101,6 @@ public interface IAlertCalledService { ...@@ -99,4 +101,6 @@ public interface IAlertCalledService {
* @return * @return
*/ */
String nextId(); String nextId();
AlarmStatisticsDto getAlertStatistics(ReginParams reginParams);
} }
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.elevator.api.dto.CtiUserDto; import com.yeejoin.amos.boot.module.elevator.api.dto.CtiUserDto;
import java.util.LinkedHashSet;
import java.util.Map; import java.util.Map;
/** /**
...@@ -50,4 +51,6 @@ public interface ICtiService { ...@@ -50,4 +51,6 @@ public interface ICtiService {
* 根据坐席配置获取主叫号码 * 根据坐席配置获取主叫号码
*/ */
CtiUserDto getCallPhone(String userId); CtiUserDto getCallPhone(String userId);
// LinkedHashSet<String> getSkillGroup(String regionCode);
} }
...@@ -5,21 +5,12 @@ ...@@ -5,21 +5,12 @@
<select id="queryAlertStatusCount" resultType="java.util.Map"> <select id="queryAlertStatusCount" resultType="java.util.Map">
SELECT SELECT
count( 1 ) calledCount, ifnull ( COUNT ( 1 ), 0 ) calledCount,
sum( CASE WHEN father_alert is null THEN ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
1 ELSE 0 END ) majorAlertCount,
sum( CASE WHEN alarm_type_code = '960' and alert_status = 0
THEN 1 ELSE 0 END )
sleepyIncidentCount,
sum( CASE WHEN alarm_type_code
= '961' THEN 1 ELSE 0 END )
faultRescueCount,
sum( CASE WHEN
alarm_type_code = '962' THEN 1 ELSE 0 END )
suggestionsCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE
skill_group LIKE CONCAT ( #{groupCode}, '%' )
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= #{beginDate} and call_time >= #{beginDate}
</if> </if>
...@@ -27,21 +18,16 @@ ...@@ -27,21 +18,16 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
#{endDate} #{endDate}
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
</select> </select>
<select id="queryNearlyCount" resultType="java.util.Map"> <select id="queryNearlyCount" resultType="java.util.Map">
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -7 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -7 DAY) "dateTime",
sum( CASE WHEN ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE
skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY)
</if> </if>
...@@ -49,19 +35,13 @@ ...@@ -49,19 +35,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -7 DAY) DATE_ADD(#{endDate},INTERVAL -7 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -6 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -6 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount FROM
FROM tz_alert_called
tz_alert_called WHERE skill_group = #{groupCode}
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY)
</if> </if>
...@@ -69,19 +49,13 @@ ...@@ -69,19 +49,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -6 DAY) DATE_ADD(#{endDate},INTERVAL -6 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -5 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -5 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY)
</if> </if>
...@@ -89,19 +63,13 @@ ...@@ -89,19 +63,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -5 DAY) DATE_ADD(#{endDate},INTERVAL -5 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -4 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -4 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -4 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -4 DAY)
</if> </if>
...@@ -109,19 +77,13 @@ ...@@ -109,19 +77,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -4 DAY) DATE_ADD(#{endDate},INTERVAL -4 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -3 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -3 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY)
</if> </if>
...@@ -129,19 +91,13 @@ ...@@ -129,19 +91,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -3 DAY) DATE_ADD(#{endDate},INTERVAL -3 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -2 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -2 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY)
</if> </if>
...@@ -149,19 +105,13 @@ ...@@ -149,19 +105,13 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -2 DAY) DATE_ADD(#{endDate},INTERVAL -2 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL UNION ALL
SELECT SELECT
DATE_ADD(#{beginDate},INTERVAL -1 DAY) "dateTime", DATE_ADD(#{beginDate},INTERVAL -1 DAY) "dateTime",
sum( ifnull ( SUM ( CASE WHEN father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) majorAlertCount
CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
tz_alert_called tz_alert_called
WHERE 1 = 1 WHERE skill_group = #{groupCode}
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY) and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY)
</if> </if>
...@@ -169,11 +119,6 @@ ...@@ -169,11 +119,6 @@
and call_time <![CDATA[ <= ]]> and call_time <![CDATA[ <= ]]>
DATE_ADD(#{endDate},INTERVAL -1 DAY) DATE_ADD(#{endDate},INTERVAL -1 DAY)
</if> </if>
<if
test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''">
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
</select> </select>
<select id="queryAlertListByQueryDto" resultType="java.util.Map"> <select id="queryAlertListByQueryDto" resultType="java.util.Map">
...@@ -641,6 +586,14 @@ ...@@ -641,6 +586,14 @@
</if> </if>
</select> </select>
<select id="getMyBacklog" resultType="java.util.Map">
SELECT ifnull(SUM(CASE WHEN alarm_type_code = '960' THEN 1 ELSE 0 END), 0) sleepyIncidentCount,
ifnull(SUM(CASE WHEN alarm_type_code = '961' THEN 1 ELSE 0 END), 0) faultRescueCount,
ifnull(SUM(CASE WHEN alarm_type_code = '962' THEN 1 ELSE 0 END), 0) suggestionsCount
FROM tz_alert_called
WHERE alert_status = false
AND skill_group = #{groupCode}
</select>
</mapper> </mapper>
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.feign.privilege.Privilege; ...@@ -25,6 +25,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
...@@ -316,57 +317,10 @@ public class AlertCalledController extends BaseController { ...@@ -316,57 +317,10 @@ public class AlertCalledController extends BaseController {
@GetMapping(value = "/alertStatistics") @GetMapping(value = "/alertStatistics")
@ApiOperation(httpMethod = "GET", value = "警情统计", notes = "警情统计") @ApiOperation(httpMethod = "GET", value = "警情统计", notes = "警情统计")
public ResponseModel<AlarmStatisticsDto> alertStatistics() { public ResponseModel<AlarmStatisticsDto> alertStatistics() {
AlarmStatisticsDto alarmStatisticsDto = new AlarmStatisticsDto();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
if(!ObjectUtils.isEmpty(reginParams)){
// 我的待办数量 alarmStatisticsDto = iAlertCalledService.getAlertStatistics(reginParams);
QueryWrapper<AlertCalled> todoNumQueryWrapper = new QueryWrapper<>();
// 全部待办数量
QueryWrapper<AlertCalled> allNumQueryWrapper = new QueryWrapper<>();
AlarmStatisticsDto alarmStatisticsDto = new AlarmStatisticsDto();
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());
alarmStatisticsDto.setTodoNum(iAlertCalledService.list(todoNumQueryWrapper).size());
alarmStatisticsDto.setAllNum(iAlertCalledService.list(allNumQueryWrapper).size());
Map<String, Object> map = iAlertCalledService.getAlertInfoList(
DateUtils.stampToDate(System.currentTimeMillis(), DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), 1).getTime(), DateUtils.DATE_PATTERN), null,
getUserInfo().getUserId());
// 当天接警
alarmStatisticsDto.setTodayAlarmNum(
map.get("calledCount") == null ? 0 : Integer.valueOf(map.get("calledCount").toString()));
// 当天提交
alarmStatisticsDto.setSubmitNum(
map.get("majorAlertCount") == null ? 0 : Integer.valueOf(map.get("majorAlertCount").toString()));
// 投诉咨询数量
alarmStatisticsDto.setSuggestions(
map.get("suggestionsCount") == null ? 0 : Integer.valueOf(map.get("suggestionsCount").toString()));
// 故障维修数量
alarmStatisticsDto.setFaultRescue(
map.get("faultRescueCount") == null ? 0 : Integer.valueOf(map.get("faultRescueCount").toString()));
// 困人救援数量
alarmStatisticsDto.setSleepyIncident(map.get("sleepyIncidentCount") == null ? 0
: Integer.valueOf(map.get("sleepyIncidentCount").toString()));
LinkedHashMap<String, Integer> recordMap = new LinkedHashMap<>();
// 近七天办理数量
Map<String, Object> nearlySevenDaysMap = iAlertCalledService.getNearlyInfo(
DateUtils.stampToDate(System.currentTimeMillis(), DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), 1).getTime(), DateUtils.DATE_PATTERN), null,
getUserInfo().getUserId());
for (int i = 0; i < nearlySevenDaysMap.size() / 2; i++) {
recordMap.put(DateUtils.dateToString(nearlySevenDaysMap.get("dateTime" + i).toString()),
Integer.parseInt(nearlySevenDaysMap.get("majorAlertCount" + i).toString()));
}
alarmStatisticsDto.setNearlySevenDaysNum(recordMap);
} }
return ResponseHelper.buildResponse(alarmStatisticsDto); return ResponseHelper.buildResponse(alarmStatisticsDto);
} }
......
...@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.elevator.biz.service.impl; ...@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SystemClock; import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...@@ -15,18 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -15,18 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService; import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.FormValue;
import com.yeejoin.amos.boot.module.elevator.api.dto.TzsCitInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.*; import com.yeejoin.amos.boot.module.elevator.api.entity.*;
import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums; import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums; import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums;
...@@ -58,15 +49,7 @@ import java.text.SimpleDateFormat; ...@@ -58,15 +49,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.*;
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; import java.util.stream.Collectors;
/** /**
...@@ -695,33 +678,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -695,33 +678,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
public Map<String, Object> getAlertInfoList(String beginDate, String endDate,String orgCode, String recUserId) { public Map<String, Object> getNearlyInfo(String beginDate, String endDate, String groupCode) {
Map<String, Object> result = Maps.newHashMap(); Map<String, Object> result = Maps.newHashMap();
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate,orgCode,recUserId); List<Map<String, Object>> statusCountMap = alertCalledMapper.queryNearlyCount(beginDate, endDate, groupCode);
for (int i = 0; i < statusCountMap.size(); i++) {
result.put("calledCount",statusCountMap.get("calledCount")); if (statusCountMap.get(i).size() > 1) {
result.put("majorAlertCount",statusCountMap.get("majorAlertCount")); result.put("dateTime" + i, statusCountMap.get(i).get("dateTime"));
result.put("sleepyIncidentCount",statusCountMap.get("sleepyIncidentCount")); result.put("majorAlertCount" + i, statusCountMap.get(i).get("majorAlertCount"));
result.put("faultRescueCount",statusCountMap.get("faultRescueCount")); } else {
result.put("suggestionsCount",statusCountMap.get("suggestionsCount")); result.put("dateTime" + i, statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount" + i, 0);
return result; }
} }
public Map<String, Object> getNearlyInfo(String beginDate, String endDate,String orgCode, String recUserId) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Integer>> statusCountMap = alertCalledMapper.queryNearlyCount(beginDate, endDate,orgCode,recUserId);
for(int i = 0; i<statusCountMap.size();i++) {
if(statusCountMap.get(i).size() > 1) {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,statusCountMap.get(i).get("majorAlertCount"));
} else {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,0);
}
}
return result; return result;
} }
...@@ -856,6 +824,70 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -856,6 +824,70 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return workOrderNumber; return workOrderNumber;
} }
@Override
public AlarmStatisticsDto getAlertStatistics(ReginParams reginParams) {
AlarmStatisticsDto alarmStatisticsDto = new AlarmStatisticsDto();
//获取当前登录人所在的技能组code
TzsCitInfo tzsCitInfo = citInfoService.getOne(new QueryWrapper<TzsCitInfo>().eq("cti_user_id", reginParams.getUserModel().getUserId()));
String groupCode = null;
if (!ValidationUtil.isEmpty(tzsCitInfo)) {
if (tzsCitInfo.getGid().contains(",")) {
groupCode = tzsCitInfo.getGid().split(",")[0];
} else {
groupCode = tzsCitInfo.getGid().split(",")[0];
}
} else {
return alarmStatisticsDto;
}
if (groupCode != null) {
Map<String, Long> myBacklogMap = alertCalledMapper.getMyBacklog(groupCode);
// 全部待办数量
QueryWrapper<AlertCalled> allNumQueryWrapper = new QueryWrapper<>();
allNumQueryWrapper.eq("alert_status", false);
// 投诉咨询数量
alarmStatisticsDto.setSuggestions(myBacklogMap.get("suggestionsCount"));
// 故障维修数量
alarmStatisticsDto.setFaultRescue(myBacklogMap.get("faultRescueCount"));
// 困人救援数量
alarmStatisticsDto.setSleepyIncident(myBacklogMap.get("sleepyIncidentCount"));
// 我的待办数量
QueryWrapper<AlertCalled> todoNumQueryWrapper = new QueryWrapper<>();
todoNumQueryWrapper.eq("alert_status", false);
todoNumQueryWrapper.eq("skill_group", groupCode);
alarmStatisticsDto.setTodoNum(this.count(todoNumQueryWrapper));
Map<String, Long> map = alertCalledMapper.queryAlertStatusCount(
DateUtils.stampToDate(System.currentTimeMillis(), DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), 1).getTime(), DateUtils.DATE_PATTERN),
groupCode);
// 当天接警
alarmStatisticsDto.setTodayAlarmNum(
map.get("calledCount") == null ? 0 : map.get("calledCount"));
// 当天提交
alarmStatisticsDto.setSubmitNum(
map.get("majorAlertCount") == null ? 0 : map.get("majorAlertCount"));
alarmStatisticsDto.setAllNum(this.count(allNumQueryWrapper));
LinkedHashMap<String, Long> recordMap = new LinkedHashMap<>();
// 近七天办理数量
Map<String, Object> nearlySevenDaysMap = getNearlyInfo(
DateUtils.stampToDate(System.currentTimeMillis(), DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), 1).getTime(), DateUtils.DATE_PATTERN), groupCode);
for (int i = 0; i < nearlySevenDaysMap.size() / 2; i++) {
recordMap.put(DateUtils.dateToString(nearlySevenDaysMap.get("dateTime" + i).toString()),
Long.valueOf(nearlySevenDaysMap.get("majorAlertCount" + i).toString()));
}
alarmStatisticsDto.setNearlySevenDaysNum(recordMap);
}
return alarmStatisticsDto;
}
private void resetCounterAndExpire() { private void resetCounterAndExpire() {
// 第二天凌晨序列重置 新开始 // 第二天凌晨序列重置 新开始
rAtomicLong.set(0); rAtomicLong.set(0);
......
...@@ -28,8 +28,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -28,8 +28,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.HashMap; import java.util.*;
import java.util.Map;
/** /**
* 联通cti 服务实现类 * 联通cti 服务实现类
...@@ -263,4 +262,24 @@ public class CtiServiceImpl implements ICtiService { ...@@ -263,4 +262,24 @@ public class CtiServiceImpl implements ICtiService {
} }
return ctiUserDto; return ctiUserDto;
} }
public LinkedHashSet<String> getSkillGroup(String regionCode) {
LinkedHashSet<String> groupCodeList = new LinkedHashSet<>();
LambdaQueryWrapper<TzsCitInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.in(TzsCitInfo::getRegionCode, regionCode);
List<TzsCitInfo> ctiInfo = ctiInfoService.list(wrapper);
if (!ValidationUtil.isEmpty(ctiInfo)) {
for (TzsCitInfo tzsCitInfo : ctiInfo) {
String groupCode = null;
if (tzsCitInfo.getGid().contains(",")) {
groupCode = tzsCitInfo.getGid().split(",")[0];
} else {
groupCode = tzsCitInfo.getGid().split(",")[0];
}
groupCodeList.add(groupCode);
}
}
return groupCodeList;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment