Commit 26c9b751 authored by 麻笑宇's avatar 麻笑宇

应急处置/月度困人故障高发使用单位

代码提交
parent 33fefe27
......@@ -97,4 +97,17 @@ public class AlertUseUnitStatistics extends BaseEntity {
@TableField("address")
private String address;
/**
* 有效期
*/
private String expiryDate;
/**
* 设备分类代码
*/
private String equipmentClassificationCode;
/**
* 设备分类
*/
private String equipmentClassification;
}
......@@ -17,10 +17,12 @@
) as mainName,
use.USE_UNIT_NAME as useName,
use.USE_UNIT_CREDIT_CODE as unitCode,
ul.expiry_date as expiryDate,
(SELECT supervise_org_name from tz_base_enterprise_info where use_unit_code = use.USE_UNIT_CREDIT_CODE) as supervisoryUnitName,
(SELECT supervise_org_code from tz_base_enterprise_info where use_unit_code = use.USE_UNIT_CREDIT_CODE) as supervisoryUnitOrgCode
from tz_alert_called tac
LEFT JOIN idx_biz_jg_use_info use on tac.equipment_id = use.RECORD
left join tz_base_unit_licence ul ON use.USE_UNIT_CREDIT_CODE = ul.unit_code
WHERE tac.alarm_type_code != '962'
and tac.equipment_id is not null
and use.ADDRESS is not null
......@@ -40,7 +42,14 @@
SELECT count(1) from tz_alert_called where alarm_type_code = '960' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null
) as trappedNum,
(
SELECT equipment_classification_code from tz_alert_called where alarm_type_code = '960' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null group by equipment_id limit 1
) as equipmentClassificationCode,
(
SELECT equipment_classification from tz_alert_called where alarm_type_code = '960' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null group by equipment_id limit 1
) as equipmentClassification,
(
SELECT count(1) from tz_alert_called where alarm_type_code = '961' and equipment_id = #{equipmentId} and call_time between #{startDate} and #{endDate}
and father_alert is null
......
......@@ -95,4 +95,17 @@ public class AlertUseUnitStatistics extends BaseEntity {
@TableField("address")
private String address;
/**
* 有效期
*/
private String expiryDate;
/**
* 设备分类代码
*/
private String equipmentClassificationCode;
/**
* 设备分类
*/
private String equipmentClassification;
}
......@@ -277,7 +277,7 @@ public class YJDPStatisticsController {
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图")
@PostMapping("/alertUnitBarChart/dp")
public ResponseModel<JSONObject> alertUnitBarChartForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) {
public ResponseModel<JSONObject> alertUnitBarChartForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) throws Exception {
return statisticsService.alertUnitBarChartForDP(detailDto);
}
......@@ -286,8 +286,8 @@ public class YJDPStatisticsController {
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-表格")
@PostMapping("/alertUseUnitTable/dp")
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
@RequestParam(value = "current", defaultValue = "1") Integer current,
@RequestParam(value = "size", defaultValue = "20") Integer size) throws Exception {
detailDto.setCurrent(current);
detailDto.setSize(size);
return statisticsService.alertUseUnitTableForDP(detailDto);
......
......@@ -472,7 +472,7 @@ public class CylinderDPStatisticsServiceImpl {
Long count = null == orgCode ? null : cylinderStatisticsMapper.countEnterpriseUsed(orgCode);
if (totalNum != null && count != null && totalNum > 0 ) {
BigDecimal percent = (new BigDecimal(count.doubleValue() * 100).divide(new BigDecimal(totalNum.doubleValue()), 2, RoundingMode.HALF_UP));
BigDecimal percent = (new BigDecimal(count.doubleValue()).divide(new BigDecimal(totalNum.doubleValue()), 2, RoundingMode.HALF_UP));
result.put("stationRate", Double.valueOf(percent.toString()));
} else {
result.put("stationRate", 0.0);
......
......@@ -571,7 +571,7 @@ public class YJDPStatisticsServiceImpl {
return ResponseHelper.buildResponse(mapPage);
}
public ResponseModel<JSONObject> alertUnitBarChartForDP(DPFilterParamForDetailDto detailDto){
public ResponseModel<JSONObject> alertUnitBarChartForDP(DPFilterParamForDetailDto detailDto) throws Exception {
JSONObject res = new JSONObject();
JSONArray legendData = new JSONArray();
legendData.add(new JSONObject()
......@@ -584,6 +584,7 @@ public class YJDPStatisticsServiceImpl {
.map(RegionModel::getRegionName)
.filter(regionName -> !"西咸新区".equals(regionName))
.collect(Collectors.toList());
String date = DateUtil.formatDate(DateTimeUtil.addMonths(new Date(), -1), "yyyy-MM");
List<? extends Number> alertUnitTotal = regionList.stream()
.map(region -> {
String orgCode = stCommonService.getAndSetOrgCode(String.valueOf(region.getRegionCode()));
......@@ -592,6 +593,7 @@ public class YJDPStatisticsServiceImpl {
}
return alertUseUnitStatisticsMapper.selectCount(new QueryWrapper<AlertUseUnitStatistics>().lambda()
.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode)
.eq(AlertUseUnitStatistics::getStatisticsDate,date)
.isNotNull(AlertUseUnitStatistics::getUseUnitCode));
}).collect(Collectors.toList());
res.put("legendData", legendData);
......@@ -600,7 +602,7 @@ public class YJDPStatisticsServiceImpl {
return ResponseHelper.buildResponse(res);
}
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(DPFilterParamForDetailDto detailDto){
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(DPFilterParamForDetailDto detailDto) throws Exception{
Page<AlertUseUnitStatistics> page = new Page<>();
page.setCurrent(detailDto.getCurrent());
page.setSize(detailDto.getSize());
......@@ -627,7 +629,8 @@ public class YJDPStatisticsServiceImpl {
}else {
lambda.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode);
}
String date = DateUtil.formatDate(DateTimeUtil.addMonths(new Date(), -1), "yyyy-MM");
lambda.ge(AlertUseUnitStatistics::getStatisticsDate, date);
// 使用单位
if (!ValidationUtil.isEmpty(detailDto.getCompanyName())){
lambda.like(AlertUseUnitStatistics::getUseUnit, detailDto.getCompanyName().trim());
......@@ -636,6 +639,19 @@ public class YJDPStatisticsServiceImpl {
if (!ValidationUtil.isEmpty(detailDto.getMaintenanceCompanyName())){
lambda.like(AlertUseUnitStatistics::getMaintenanceUnit, detailDto.getMaintenanceCompanyName().trim());
}
// 开始时间
if (!ValidationUtil.isEmpty(detailDto.getTimeSearchOne().getBeginDate())){
lambda.ge(AlertUseUnitStatistics::getStartDate, detailDto.getTimeSearchOne().getBeginDate());
}
// 结束时间
if (!ValidationUtil.isEmpty(detailDto.getTimeSearchOne().getEndDate())){
lambda.le(AlertUseUnitStatistics::getEndDate, detailDto.getTimeSearchOne().getEndDate());
}
// 设备类型
if (!ValidationUtil.isEmpty(detailDto.getEquListCode())){
lambda.le(AlertUseUnitStatistics::getEquipmentClassificationCode, detailDto.getEquListCode());
}
IPage<AlertUseUnitStatistics> alertUseUnitStatistics = alertUseUnitStatisticsMapper.selectPage(page, lambda);
return ResponseHelper.buildResponse(alertUseUnitStatistics);
}
......
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