From a22e9756ca5956ffcb098223f677104001a421ae Mon Sep 17 00:00:00 2001 From: zpl Date: Thu, 9 Sep 2021 10:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E3=80=81=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=B4=9F=E8=8D=B7=E7=8E=87=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ReportDataController.java | 7 +- .../common/mapper/ReportDataMapper.java | 6 +- .../common/service/ReportDataService.java | 5 +- .../service/impl/ReportDataServiceImpl.java | 20 ++- .../resources/mapper/ReportDataMapper.xml | 117 ++++++++++-------- 5 files changed, 87 insertions(+), 68 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/controller/ReportDataController.java b/common/src/main/java/com/foreverwin/mesnac/common/controller/ReportDataController.java index 45b13862..489c8013 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/controller/ReportDataController.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/controller/ReportDataController.java @@ -57,21 +57,22 @@ public class ReportDataController { } /** - * 设备负荷率报表 + * 设备、设备类型负荷率报表 * 查询设备每日的负荷率 * @param paramMap * @return */ - @GetMapping("/findResourceLoadRateInfo") + @GetMapping("/findResourceOrResourceTypeLoadRateInfo") public R findResourceLoadRateInfo(@RequestParam(required = false) Map paramMap) { try { - List> result = reportDataService.findResourceLoadRateInfo(paramMap); + List> result = reportDataService.findResourceOrResourceTypeLoadRateInfo(paramMap); return R.ok(result); } catch (Exception e) { return R.failed(e.getMessage()); } } + /** * 设备维修数据统计报表 * diff --git a/common/src/main/java/com/foreverwin/mesnac/common/mapper/ReportDataMapper.java b/common/src/main/java/com/foreverwin/mesnac/common/mapper/ReportDataMapper.java index e90cbccd..99997824 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/mapper/ReportDataMapper.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/mapper/ReportDataMapper.java @@ -15,13 +15,15 @@ public interface ReportDataMapper { List> findResourceLoadRateInfo(Map paramMap); + List> findResourceTypeLoadRateInfo(Map paramMap); + List> findResourceRepairDataStatInfo(Map paramMap); List> findProductStateInfo(Map paramMap); - void insertReportDateTimeByStartToDate(@Param("site") String site ,@Param("startFromDate") String startFromDate,@Param("startToDate") String startToDate); +/* void insertReportDateTimeByStartToDate(@Param("site") String site ,@Param("startFromDate") String startFromDate,@Param("startToDate") String startToDate); - void deleteAllReportDateTime(); + void deleteAllReportDateTime();*/ List> findWorkShopPassRate(Map paramMap); diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/ReportDataService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/ReportDataService.java index a7819bb3..c12c2e47 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/ReportDataService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/ReportDataService.java @@ -21,12 +21,13 @@ public interface ReportDataService { List> findInspectionTaskDetail(Map paramMap); /** - * 设备负荷率报表 + * 设备、设备类型负荷率报表 * * @param paramMap * @return */ - List> findResourceLoadRateInfo(Map paramMap); + List> findResourceOrResourceTypeLoadRateInfo(Map paramMap); + /** * 设备维修数据统计报表 * diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/ReportDataServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/ReportDataServiceImpl.java index cb4de8b1..3eb3964e 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/ReportDataServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/ReportDataServiceImpl.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -30,7 +31,7 @@ public class ReportDataServiceImpl implements ReportDataService{ } @Override - public List> findResourceLoadRateInfo(Map paramMap) { + public List> findResourceOrResourceTypeLoadRateInfo(Map paramMap) { String site = CommonMethods.getSite(); paramMap.put("site",site); String startFromDate = (String) paramMap.get("startFromDate"); @@ -41,11 +42,18 @@ public class ReportDataServiceImpl implements ReportDataService{ }catch (Exception e){ throw BusinessException.build("时间格式错误!"); } - // 清空日期表数据 - reportDataMapper.deleteAllReportDateTime(); - // 插入日期查询范围 - reportDataMapper.insertReportDateTimeByStartToDate(site,startFromDate,startToDate); - List> resourceLoadRateInfo = reportDataMapper.findResourceLoadRateInfo(paramMap); + String resourceOrResourceType = (String) paramMap.get("resourceOrResourceType"); + List> resourceLoadRateInfo; + switch (resourceOrResourceType){ + case "RESOURCE_TYPE": + resourceLoadRateInfo = reportDataMapper.findResourceTypeLoadRateInfo(paramMap); + break; + case "RESOURCE": + resourceLoadRateInfo = reportDataMapper.findResourceLoadRateInfo(paramMap); + break; + default: + throw BusinessException.build("未找到查询路径!"); + } if (resourceLoadRateInfo.size() < 1){ throw BusinessException.build("按条件查询未找到数据!"); } diff --git a/common/src/main/resources/mapper/ReportDataMapper.xml b/common/src/main/resources/mapper/ReportDataMapper.xml index 4a55a299..a8e1f3f9 100644 --- a/common/src/main/resources/mapper/ReportDataMapper.xml +++ b/common/src/main/resources/mapper/ReportDataMapper.xml @@ -54,31 +54,25 @@ - @@ -365,10 +372,10 @@ - + INSERT INTO Z_REPORT_DATE_TIME - SELECT '1000' ,TO_CHAR(TO_DATE(#{startFromDate},'YYYY-MM-DD') + ROWNUM -1, 'YYYY-MM-DD') DATE_TIME, + SELECT '1000' SITE ,TO_CHAR(TO_DATE(#{startFromDate},'YYYY-MM-DD') + ROWNUM -1, 'YYYY-MM-DD') DATE_TIME, TO_DATE(#{startFromDate} || '00:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 AM_START_DATE_TIME, TO_DATE(#{startFromDate} || '04:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 AM_END_DATE_TIME, TO_DATE(#{startFromDate} || '05:00:00','yyyy-mm-dd hh24:mi:ss') + rownum -1 PM_START_DATE_TIME ,