Commit f2d564a7 authored by 韩桐桐's avatar 韩桐桐

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 75ae644d de994286
......@@ -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);
}
......@@ -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>
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.elevator.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertMaintenanceUnitStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertUseUnitStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.DPStatisticsServiceImpl;
import io.swagger.annotations.Api;
......@@ -85,6 +87,17 @@ public class DPStatisticsController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-即时警情列表", notes = "大屏-应急-即时警情列表")
@PostMapping(value = "/yj/instantAlert")
public ResponseModel<List<AlertPaperInfoDto>> instantAlert(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.instantAlert(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-月度困人故障高发使用单位", notes = "大屏-应急-月度困人故障高发使用单位")
@PostMapping(value = "/yj/trappedUserHighCompanyCount")
public ResponseModel<List<AlertUseUnitStatisticsDto>> trappedUserHighCompanyCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
......@@ -105,4 +118,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));
}
}
......@@ -3,31 +3,30 @@ 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;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertMaintenanceUnitStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertUseUnitStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertMaintenanceUnitStatistics;
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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 +55,23 @@ public class DPStatisticsServiceImpl {
private AlertMaintenanceUnitStatisticsMapper alertMaintenanceUnitStatisticsMapper;
private AlertStatisticsMapper alertStatisticsMapper;
@Autowired
AlertCalledServiceImpl alertCalledService;
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 {
......@@ -140,6 +145,13 @@ public class DPStatisticsServiceImpl {
return jsonObject;
}
public List<AlertPaperInfoDto> instantAlert(DPFilterParamDto dpFilterParamDto) throws Exception {
List<String> regionCodes = new ArrayList<>();
regionCodes.add(dpFilterParamDto.getCityCode());
List<AlertPaperInfoDto> alertPaperInfoDtoList = alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
return alertPaperInfoDtoList;
}
public JSONObject trappedUserCount(DPFilterParamDto dpFilterParamDto) throws Exception {
String date = DateUtil.formatDate(new Date(), "yyyy-MM");
String orgCode = this.getAndSetOrgCode(dpFilterParamDto);
......@@ -253,5 +265,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());
}
}
}
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