diff --git a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java index 931e60a0..cd7e6274 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java @@ -235,6 +235,33 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.selectTypeNonAutomaticWarning(dcWarning)); } + + @ApiOperation(value = "导出非机预警统计分析(按事件分类)",tags = {"ECharts导出"}) + @GetMapping("/exportNonAutomaticWarningType") + public void exportNonAutomaticWarningType(HttpServletResponse response, DcWarning dcWarning){ + List list = new ArrayList<>(); + + if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){ + + } else { + List> data = perceivedEventsWarningService.selectTypeNonAutomaticWarning(dcWarning); + Long total = data.stream().mapToLong(item -> (long) item.get("number")).sum(); + for (Map datum : data) { + NonAutomaticWarningType nonAutomaticWarningType = new NonAutomaticWarningType(); + nonAutomaticWarningType.setSubclass(datum.get("subclass").toString()); + nonAutomaticWarningType.setNumber(datum.get("number").toString()); + //计算百分比 + double ratio = (double) Long.parseLong(datum.get("number").toString()) / total * 100; + ratio = Math.round(ratio * 100.0) / 100.0; + nonAutomaticWarningType.setRatio(ratio + "%"); + list.add(nonAutomaticWarningType); + } + } + + ExcelUtil util = new ExcelUtil<>(NonAutomaticWarningType.class); + util.exportExcel(response, list, "统计分析"); + } + //查询非机预警,按照时间查询(传入时间类型type与时间warningTime) @PostMapping("/nonAutomaticWarningTimeType") public AjaxResult nonAutomaticWarningTimeType(@RequestBody DcWarning dcWarning){ @@ -243,6 +270,28 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.selectNonAutomaticWarningTimeType(dcWarning)); } + + @ApiOperation(value = "导出非机预警统计分析(按日期)",tags = {"ECharts导出"}) + @GetMapping("/exportNonAutomaticWarningTimeType") + public void exportNonAutomaticWarningTimeType(HttpServletResponse response, DcWarning dcWarning){ + List list = new ArrayList<>(); + + if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){ + + } else { + List> data = perceivedEventsWarningService.selectNonAutomaticWarningTimeType(dcWarning); + for (Map datum : data) { + NonAutomaticWarningTimeType nonAutomaticWarningTimeType = new NonAutomaticWarningTimeType(); + nonAutomaticWarningTimeType.setTime(datum.get("time").toString()); + nonAutomaticWarningTimeType.setNumber(datum.get("number").toString()); + list.add(nonAutomaticWarningTimeType); + } + } + + ExcelUtil util = new ExcelUtil<>(NonAutomaticWarningTimeType.class); + util.exportExcel(response, list, "统计分析"); + } + //查询非机预警,按照时间查询收费站分组(传入时间类型type与时间warningTime) @PostMapping("/nonAutomaticWarningFacility") public AjaxResult nonAutomaticWarningFacility(@RequestBody DcWarning dcWarning){ @@ -252,6 +301,32 @@ public class DCPerceivedEventsWarningController extends BaseController { return AjaxResult.success(perceivedEventsWarningService.selectNonAutomaticWarningFacility(dcWarning)); } + @ApiOperation(value = "导出非机预警统计分析(按事件分类)",tags = {"ECharts导出"}) + @GetMapping("/exportNonAutomaticWarningFacility") + public void exportNonAutomaticWarningFacility(HttpServletResponse response, DcWarning dcWarning){ + List list = new ArrayList<>(); + + if (StringUtils.isBlank(dcWarning.getType())||dcWarning.getWarningTime()==null){ + + } else { + List> data = perceivedEventsWarningService.selectNonAutomaticWarningFacility(dcWarning); + Long total = data.stream().mapToLong(item -> (long) item.get("number")).sum(); + for (Map datum : data) { + NonAutomaticWarningFacility nonAutomaticWarningFacility = new NonAutomaticWarningFacility(); + nonAutomaticWarningFacility.setFacilityName(datum.get("facilityName").toString()); + nonAutomaticWarningFacility.setNumber(datum.get("number").toString()); + //计算百分比 + double ratio = (double) Long.parseLong(datum.get("number").toString()) / total * 100; + ratio = Math.round(ratio * 100.0) / 100.0; + nonAutomaticWarningFacility.setRatio(ratio + "%"); + list.add(nonAutomaticWarningFacility); + } + } + + ExcelUtil util = new ExcelUtil<>(NonAutomaticWarningFacility.class); + util.exportExcel(response, list, "统计分析"); + } + //新-感知事件多发时段 @PostMapping("/manyTimesInterval") public AjaxResult manyTimesInterval(@RequestBody DcWarning dcWarning){ diff --git a/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningFacility.java b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningFacility.java new file mode 100644 index 00000000..805ef006 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningFacility.java @@ -0,0 +1,61 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 导出非机预警统计分析(按站点)对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class NonAutomaticWarningFacility extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 站点 */ + @Excel(name = "站点") + private String facilityName; + + /** 数量 */ + @Excel(name = "数量") + private String number; + /** 占比 */ + @Excel(name = "占比") + private String ratio; + + public String getFacilityName() { + return facilityName; + } + + public void setFacilityName(String facilityName) { + this.facilityName = facilityName; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public String getRatio() { + return ratio; + } + + public void setRatio(String ratio) { + this.ratio = ratio; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("facilityName", facilityName) + .append("number", number) + .append("ratio", ratio) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningTimeType.java b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningTimeType.java new file mode 100644 index 00000000..7af7bfa6 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningTimeType.java @@ -0,0 +1,49 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 导出非机预警统计分析(按日期)对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class NonAutomaticWarningTimeType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 时间 */ + @Excel(name = "时间") + private String time; + + /** 数量 */ + @Excel(name = "数量") + private String number; + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("time", time) + .append("number", number) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningType.java b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningType.java new file mode 100644 index 00000000..8a421d2b --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/NonAutomaticWarningType.java @@ -0,0 +1,61 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 导出非机预警统计分析(按事件分类)对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class NonAutomaticWarningType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 类型 */ + @Excel(name = "类型") + private String subclass; + + /** 数量 */ + @Excel(name = "数量") + private String number; + /** 占比 */ + @Excel(name = "占比") + private String ratio; + + public String getSubclass() { + return subclass; + } + + public void setSubclass(String subclass) { + this.subclass = subclass; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public String getRatio() { + return ratio; + } + + public void setRatio(String ratio) { + this.ratio = ratio; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("subclass", subclass) + .append("number", number) + .append("ratio", ratio) + .toString(); + } +}