From 7c7463d2f5012c27ac50f1d2ac39fa09616fc813 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期五, 23 八月 2024 11:29:31 +0800
Subject: [PATCH] update

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java |   35 +++++++++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java          |   14 +++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java            |    1 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java    |   14 +++++-
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MonthEquipmentUtilizationRateDto.java   |   24 ++++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml         |   14 +++++++
 6 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
index 2856e59..793168c 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
@@ -6,6 +6,7 @@
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.screen.dto.*;
 import org.jeecg.modules.screen.service.MdcLargeScreenService;
+import org.jeecg.modules.system.entity.MdcProduction;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -31,7 +32,7 @@
     @ApiOperation(value = "鎬绘帶鐪嬫澘-浠婃棩鐢熶骇杩涘害", notes = "鎬绘帶鐪嬫澘-浠婃棩鐢熶骇杩涘害")
     @GetMapping("/todayProductionSchedule")
     public Result<?> todayProductionSchedule() {
-        List<TodayProductionDto> result =  mdcLargeScreenService.todayProductionSchedule();
+        List<TodayProductionDto> result = mdcLargeScreenService.todayProductionSchedule();
         return Result.ok(result);
     }
 
@@ -58,6 +59,7 @@
 
     /**
      * 寮�鏈虹巼鍒╃敤鐜�
+     *
      * @return
      */
     @ApiOperation(value = "鎬绘帶鐪嬫澘-浠婃棩璁惧宸ヤ綔鏁堢巼", notes = "鎬绘帶鐪嬫澘-浠婃棩璁惧宸ヤ綔鏁堢巼")
@@ -70,8 +72,14 @@
     @ApiOperation(value = "鎬绘帶鐪嬫澘-鏈堣澶囧埄鐢ㄧ巼", notes = "鎬绘帶鐪嬫澘-鏈堣澶囧埄鐢ㄧ巼")
     @GetMapping("/monthEquipmentUtilizationRate")
     public Result<?> monthEquipmentUtilizationRate() {
-
-        return Result.ok();
+        List<MonthEquipmentUtilizationRateDto> result = mdcLargeScreenService.monthEquipmentUtilizationRate();
+        return Result.ok(result);
     }
 
+    @ApiOperation(value = "鎬绘帶鐪嬫澘-浜х嚎鍒楄〃", notes = "鎬绘帶鐪嬫澘-浜х嚎鍒楄〃")
+    @GetMapping("/productionList")
+    public Result<?> productionList() {
+        List<MdcProduction> result = mdcLargeScreenService.productionList();
+        return Result.ok(result);
+    }
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MonthEquipmentUtilizationRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MonthEquipmentUtilizationRateDto.java
new file mode 100644
index 0000000..26a075e
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MonthEquipmentUtilizationRateDto.java
@@ -0,0 +1,24 @@
+package org.jeecg.modules.screen.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Lius
+ * @date 2024/8/22 17:03
+ */
+@Data
+public class MonthEquipmentUtilizationRateDto {
+
+    /**
+     * 鏃ユ湡
+     */
+    private String date;
+
+    /**
+     * 鍒╃敤鐜�
+     */
+    private BigDecimal utilizationRate = BigDecimal.ZERO;
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java
index 5f39c04..f913de3 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java
@@ -31,4 +31,5 @@
 
     List<MdcEfficiencyDto> efficiencyList(@Param("date") String date);
 
+    List<MdcEfficiencyDto> efficiency(@Param("startDate") String startDate, @Param("endDate") String endDate);
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml
index 575cfa5..673d244 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml
@@ -81,4 +81,18 @@
         WHERE
             t1.the_date = #{date}
     </select>
+
+    <select id="efficiency" resultType="org.jeecg.modules.mdc.dto.MdcEfficiencyDto">
+        SELECT
+            the_date,
+            SUM ( process_long ) process_long
+        FROM
+            mdc_equipment_statistical_info
+        WHERE
+            the_date BETWEEN #{startDate} AND #{endDate}
+        GROUP BY
+            the_date
+        ORDER BY
+            the_date ASC
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java
index 0ea67b4..1c9f54d 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.screen.service;
 
 import org.jeecg.modules.screen.dto.*;
+import org.jeecg.modules.system.entity.MdcProduction;
 
 import java.util.List;
 import java.util.Map;
@@ -46,4 +47,17 @@
      */
     List<EquipmentRateDto> todayEquipmentRate();
 
+    /**
+     * 鏈堣澶囧埄鐢ㄧ巼
+     *
+     * @return
+     */
+    List<MonthEquipmentUtilizationRateDto> monthEquipmentUtilizationRate();
+
+    /**
+     * 浜х嚎鍒楄〃
+     * @return
+     */
+    List<MdcProduction> productionList();
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
index 31e82b7..7874e7a 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
@@ -1,5 +1,7 @@
 package org.jeecg.modules.screen.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.modules.mdc.dto.MdcEfficiencyDto;
 import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService;
 import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule;
@@ -7,6 +9,8 @@
 import org.jeecg.modules.screen.dto.*;
 import org.jeecg.modules.screen.mapper.MdcLargeScreenMapper;
 import org.jeecg.modules.screen.service.MdcLargeScreenService;
+import org.jeecg.modules.system.entity.MdcProduction;
+import org.jeecg.modules.system.service.IMdcProductionService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -32,6 +36,9 @@
     private final String yesterday = LocalDate.now().plusDays(-1).toString().replaceAll("-", "");
 
     private final String today = LocalDate.now().toString();
+
+    @Resource
+    private IMdcProductionService mdcProductionService;
 
 
     /**
@@ -124,4 +131,32 @@
         }
         return result;
     }
+
+    /**
+     * 鏈堝埄鐢ㄧ巼
+     *
+     * @return
+     */
+    @Override
+    public List<MonthEquipmentUtilizationRateDto> monthEquipmentUtilizationRate() {
+        List<MonthEquipmentUtilizationRateDto> result = new ArrayList<>();
+        String startDate = LocalDate.now().plusDays(-32).toString().replaceAll("-", "");
+        List<MdcEfficiencyDto> mdcEfficiencyDtoList = mdcLargeScreenMapper.efficiency(startDate, yesterday);
+        if (mdcEfficiencyDtoList != null && !mdcEfficiencyDtoList.isEmpty()) {
+            for (MdcEfficiencyDto mdcEfficiencyDto : mdcEfficiencyDtoList) {
+                MonthEquipmentUtilizationRateDto meu = new MonthEquipmentUtilizationRateDto();
+                meu.setDate(new StringBuilder(mdcEfficiencyDto.getTheDate().substring(4, 8)).insert(2, "-").toString());
+                BigDecimal equipmentCount = mdcLargeScreenMapper.findEquipmentCount(yesterday);
+                meu.setUtilizationRate(mdcEfficiencyDto.getProcessLong().divide(equipmentCount.multiply(new BigDecimal("86400")), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
+                result.add(meu);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public List<MdcProduction> productionList() {
+        return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, "3").eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+    }
+
 }

--
Gitblit v1.9.3