From 2c253b024f2ddd86a006d693c3ebaa8ca1c041d9 Mon Sep 17 00:00:00 2001 From: PQZ Date: Mon, 21 Oct 2024 17:03:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E6=95=B0=E6=8D=AE=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/RepairStatisticsController.java | 139 ++++++++++++++++++ .../base/mapper/RepairStatisticsMapper.java | 99 +++++++++++++ .../base/service/RepairStatisticsService.java | 85 +++++++++++ .../impl/RepairStatisticsServiceImpl.java | 131 +++++++++++++++++ .../module/base/vo/RepairStatisticsVO.java | 13 ++ .../base/vo/RepairTicketStatisticsVO.java | 20 +++ .../mapper/base/RepairStatisticsMapper.xml | 126 ++++++++++++++++ 7 files changed, 613 insertions(+) create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/controller/admin/RepairStatisticsController.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairStatisticsMapper.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairStatisticsService.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairStatisticsServiceImpl.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairStatisticsVO.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairTicketStatisticsVO.java create mode 100644 dl-module-repair/src/main/resources/mapper/base/RepairStatisticsMapper.xml diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/controller/admin/RepairStatisticsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/controller/admin/RepairStatisticsController.java new file mode 100644 index 00000000..de69dcd8 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/controller/admin/RepairStatisticsController.java @@ -0,0 +1,139 @@ +package cn.iocoder.yudao.module.base.controller.admin; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.base.service.RepairStatisticsService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@Tag(name = "维修数据统计") +@RestController +@RequestMapping("/repair/statistics") +@Validated +public class RepairStatisticsController { + @Resource + private RepairStatisticsService statisticsService; + + /** + * 客户来源分析饼图 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/customerSource") + @Operation(summary = "客户来源分析饼图") + public CommonResult customerSource() { + return CommonResult.success(statisticsService.customerSource()); + } + + /** + * 月工单金额走势折线图 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketMainAmount") + @Operation(summary = "月工单金额走势") + public CommonResult ticketMainAmount() { + return CommonResult.success(statisticsService.ticketMain("amount")); + } + + /** + * 月工单数量走势折线图 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketMainCount") + @Operation(summary = "月工单数量走势") + public CommonResult ticketMainCount() { + return CommonResult.success(statisticsService.ticketMain("count")); + } + + /** + * 支付渠道统计柱状图 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketMainPayWay") + @Operation(summary = "支付渠道统计") + public CommonResult ticketMainPayWay() { + return CommonResult.success(statisticsService.ticketMain("payWay")); + } + + /** + * 维修类型相关统计分析饼图 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketMainPayWay") + @Operation(summary = "维修类型相关统计分析饼图") + public CommonResult repairTypeStatistics() { + return CommonResult.success(statisticsService.repairTypeStatistics()); + } + + /** + * 工单总数、今日工单、工单总金额、今日工单金额 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketStatistics") + @Operation(summary = "工单总数、今日工单、工单总金额、今日工单金额") + public CommonResult ticketStatistics() { + return CommonResult.success(statisticsService.ticketStatistics()); + } + + /** + * 工单状态数量统计 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/ticketStatusCount") + @Operation(summary = "工单状态数量统计") + public CommonResult ticketStatusCount() { + return CommonResult.success(statisticsService.ticketStatusCount()); + } + + /** + * 今日工单 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/listTicketToday") + @Operation(summary = "今日工单") + public CommonResult listTicketToday() { + return CommonResult.success(statisticsService.listTicketToday()); + } + + /** + * 维修工人排行 + * + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:15 2024/10/21 + **/ + @GetMapping("/listWorks") + @Operation(summary = "维修工人排行") + public CommonResult listWorks() { + return CommonResult.success(statisticsService.listWorks()); + } + +} \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairStatisticsMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairStatisticsMapper.java new file mode 100644 index 00000000..bd4e7cbb --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairStatisticsMapper.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.base.mapper; + +import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO; +import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 维修数据统计 + * + * @author pqz + */ +@Mapper +public interface RepairStatisticsMapper { + + /** + * 客户来源统计 + * + * @return java.util.List + * @author PQZ + * @date 13:57 2024/10/21 + **/ + List customerSource(); + + /** + * 月工单数量走势 + * + * @return java.util.List + * @author PQZ + * @date 14:25 2024/10/21 + **/ + List ticketCountTrend(); + + /** + * 月工单金额走势 + * + * @return java.util.List + * @author PQZ + * @date 14:31 2024/10/21 + **/ + List ticketAmountTrend(); + + /** + * 按照支付方式统计 + * + * @return java.util.List + * @author PQZ + * @date 14:41 2024/10/21 + **/ + List paymentWay(); + + /** + * 维修方式统计饼图 + * + * @return java.util.List + * @author PQZ + * @date 14:52 2024/10/21 + **/ + List repairTypeStatistics(); + + /** + * 工单总数、今日工单、工单总金额、今日工单金额 + * + * @return cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO + * @author PQZ + * @date 15:31 2024/10/21 + **/ + RepairTicketStatisticsVO ticketStatistics(); + + /** + * 工单状态数量统计 + * + * @return java.util.List + * @author PQZ + * @date 15:44 2024/10/21 + **/ + List ticketStatusCount(); + + /** + * 今日工单 + * + * @return java.util.List + * @author PQZ + * @date 15:50 2024/10/21 + **/ + List listTicketToday(); + + + /** + * 维修工人排行 + * @author PQZ + * @date 16:13 2024/10/21 + * @return java.util.List + **/ + List listWorks(); + +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairStatisticsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairStatisticsService.java new file mode 100644 index 00000000..dde50d36 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairStatisticsService.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.base.service; + +import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO; +import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; + +import java.util.List; +import java.util.Map; + +/** + * 维修数据统计 + * + * @author pqz + */ +public interface RepairStatisticsService { + + /** + * 客户来源分析饼图 + * + * @return java.util.List + * @author PQZ + * @date 14:01 2024/10/21 + **/ + List customerSource(); + + /** + * 月工单数量、金额走势、支付渠道统计 + * @author PQZ + * @date 14:32 2024/10/21 + * @param type 'amount:金额,count:数量',payWay:支付渠道 + * @return java.util.Map + **/ + Map ticketMain(String type); + + /** + * 维修类型相关统计分析饼图 + * + * @return java.util.Map + * @author PQZ + * @date 13:25 2024/10/21 + **/ + List repairTypeStatistics(); + + + /** + * 工单总数、今日工单、工单总金额、今日工单金额 + * + * @return java.util.Map + * @author PQZ + * @date 13:23 2024/10/21 + **/ + RepairTicketStatisticsVO ticketStatistics(); + + /** + * 工单状态数量统计 + * + * @return java.util.Map + * @author PQZ + * @date 13:28 2024/10/21 + **/ + List ticketStatusCount(); + + + /** + * 今日工单 + * + * @return java.util.List + * @author PQZ + * @date 13:25 2024/10/21 + **/ + List listTicketToday(); + + + + /** + * 维修工人排行 + * + * @return java.util.List + * @author PQZ + * @date 13:26 2024/10/21 + **/ + List listWorks(); + + +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairStatisticsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairStatisticsServiceImpl.java new file mode 100644 index 00000000..816ecd96 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairStatisticsServiceImpl.java @@ -0,0 +1,131 @@ +package cn.iocoder.yudao.module.base.service.impl; + +import cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper; +import cn.iocoder.yudao.module.base.service.RepairStatisticsService; +import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO; +import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 维修数据统计 + * + * @author pqz + */ +@Service +@Validated +public class RepairStatisticsServiceImpl implements RepairStatisticsService { + + @Resource + private RepairStatisticsMapper statisticsMapper; + + /** + * 客户来源分析饼图 + * + * @return java.util.List + * @author PQZ + * @date 14:01 2024/10/21 + **/ + @Override + public List customerSource() { + return statisticsMapper.customerSource(); + } + + /** + * 月工单数量、金额走势、支付渠道统计 + * + * @return java.util.Map + * @author PQZ + * @date 13:20 2024/10/21 + **/ + @Override + public Map ticketMain(String type) { + Map result = new HashMap<>(); + List tickets; + if ("count".equals(type)) { + //月工单数量走势折线图 + tickets = statisticsMapper.ticketCountTrend(); + } else if ("amount".equals(type)) { + //月工单金额走势折线图 + tickets = statisticsMapper.ticketAmountTrend(); + } else { + //支付渠道柱状图 + tickets = statisticsMapper.paymentWay(); + } + //取出数值 + List data = tickets.stream().map(RepairStatisticsVO::getValue).collect(Collectors.toList()); + //x轴值 + List xData = tickets.stream().map(RepairStatisticsVO::getName).collect(Collectors.toList()); + result.put("data", data); + result.put("xData", xData); + return result; + } + + /** + * 维修类型相关统计分析饼图 + * + * @return java.util.Map + * @author PQZ + * @date 13:25 2024/10/21 + **/ + @Override + public List repairTypeStatistics() { + return statisticsMapper.repairTypeStatistics(); + } + + + /** + * 工单总数、今日工单、工单总金额、今日工单金额 + * + * @return java.util.Map + * @author PQZ + * @date 13:23 2024/10/21 + **/ + @Override + public RepairTicketStatisticsVO ticketStatistics() { + return statisticsMapper.ticketStatistics(); + } + + /** + * 工单状态数量统计 + * + * @return java.util.Map + * @author PQZ + * @date 13:28 2024/10/21 + **/ + @Override + public List ticketStatusCount() { + return statisticsMapper.ticketStatusCount(); + } + + /** + * 今日工单 + * + * @return java.util.List + * @author PQZ + * @date 13:25 2024/10/21 + **/ + @Override + public List listTicketToday() { + return statisticsMapper.listTicketToday(); + } + + /** + * 维修工人排行 + * + * @return java.util.List + * @author PQZ + * @date 13:26 2024/10/21 + **/ + @Override + public List listWorks() { + return statisticsMapper.listWorks(); + } +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairStatisticsVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairStatisticsVO.java new file mode 100644 index 00000000..0cbc2575 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairStatisticsVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.base.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.ToString; + +@Schema(description = "数据统计VO") +@Data +@ToString(callSuper = true) +public class RepairStatisticsVO { + String name; + Integer value; +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairTicketStatisticsVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairTicketStatisticsVO.java new file mode 100644 index 00000000..bf6d22e0 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairTicketStatisticsVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.base.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.ToString; + +@Schema(description = "数据统计VO") +@Data +@ToString(callSuper = true) +public class RepairTicketStatisticsVO { + /**工单总数量*/ + Integer totalCount; + /**工单总金额*/ + Double totalAmount; + /**工单今日数量*/ + Integer todayCount; + /**工单今日金额*/ + Double todayAmount; + +} diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairStatisticsMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairStatisticsMapper.xml new file mode 100644 index 00000000..3f526343 --- /dev/null +++ b/dl-module-repair/src/main/resources/mapper/base/RepairStatisticsMapper.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + +