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

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

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