From 4a1ef7f62d8fc364bef0e0caa02b1792bd052513 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 15 一月 2024 17:45:34 +0800
Subject: [PATCH] 扭矩工作曲线展示

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java |   12 +++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java              |   21 ++++++----
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java                      |   21 ++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java         |   16 --------
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java                 |   12 ++----
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml              |   18 +++++++--
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java      |   16 +++----
 7 files changed, 69 insertions(+), 47 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
index 49a6baf..2049898 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
@@ -19,7 +19,6 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.List;
 
 /**
  * @Description: 鎵煩閰嶇疆绠$悊
@@ -141,21 +140,6 @@
     @RequestMapping("/importExcel")
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, MdcTorqueConfig.class);
-    }
-
-    /**
-     * 鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�
-     *
-     * @param torqueValue
-     * @return
-     */
-    @AutoLog(value = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�")
-    @ApiOperation(value = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�", notes = "鎵煩閰嶇疆绠$悊-鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�")
-    @GetMapping("/findSpindleRunningCurve")
-    public Result<List<MdcTorqueConfig>> findSpindleRunningCurve(@RequestParam(name = "torqueValue", required = true) float torqueValue,
-                                                                 @RequestParam(name = "equipmentId", required = true) String equipmentId) {
-        List<MdcTorqueConfig> list = mdcTorqueConfigService.findSpindleRunningCurve(torqueValue, equipmentId);
-        return Result.ok(list);
     }
 
     /**
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java
index 9fe7824..237b5ac 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java
@@ -467,6 +467,12 @@
     //澶囨敞
     private String remark;
 
+    //鎵煩鍊�
+    private float torqueValue;
+
+    //杩涚粰鍙傛暟
+    private String feedParameter;
+
     // 璁惧椹卞姩鍙傛暟
     private List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList;
 
@@ -990,6 +996,21 @@
         this.remark = remark;
     }
 
+    public float getTorqueValue() {
+        return torqueValue;
+    }
+
+    public void setTorqueValue(float torqueValue) {
+        this.torqueValue = torqueValue;
+    }
+
+    public String getFeedParameter() {
+        return feedParameter;
+    }
+
+    public void setFeedParameter(String feedParameter) {
+        this.feedParameter = feedParameter;
+    }
 
     public void setMdcDriveTypeParamConfigList(List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList) {
         this.mdcDriveTypeParamConfigList = mdcDriveTypeParamConfigList;
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java
index 687f912..1162950 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java
@@ -4,8 +4,10 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
 import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -17,14 +19,6 @@
 public interface MdcTorqueConfigMapper extends BaseMapper<MdcTorqueConfig> {
 
     /**
-     * 鏍规嵁鎵煩鍊煎拰璁惧缂栧彿鐢熸垚涓昏酱杩愯鏇茬嚎
-     * @param torqueValue
-     * @return
-     */
-    List<MdcTorqueConfig> findSpindleRunningCurve(@Param("torqueValue") float torqueValue, @Param("equipmentId") String equipmentId);
-
-
-    /**
      * 鍒嗛〉鏌ヨ
      * @param pageData
      * @param mdcTorqueConfig
@@ -33,4 +27,6 @@
     IPage<MdcTorqueConfig> pageList(IPage<MdcTorqueConfig> pageData, @Param("mdcTorqueConfig") MdcTorqueConfig mdcTorqueConfig);
 
     MdcTorqueConfig findLast(@Param("equipmentId") String equipmentId);
+
+    List<EquipmentMachingDto> getWorkLineList(@Param("equipmentId") String equipmentId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml
index ef4f0c3..8adc1de 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml
@@ -1,10 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper">
-    <!--鏍规嵁鎵煩鍊肩敓鎴愪富杞磋繍琛屾洸绾�-->
-    <select id="findSpindleRunningCurve" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig">
-        select mtc.* from mdc_torque_config mtc where mtc.torque_value=#{torqueValue} and mtc.equipment_id=#{equipmentId}
-    </select>
 
     <!--鏍规嵁杞﹂棿灞傜骇鏌ヨ鎵煩閰嶇疆鍒楄〃-->
     <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig">
@@ -39,4 +35,18 @@
         ORDER BY
             torque_date DESC
     </select>
+
+    <!--鐢熸垚宸ヤ綔鏇茬嚎-->
+    <select id="getWorkLineList" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto">
+        SELECT
+            torque_date CollectTime,
+            torque_value,
+            feed_parameter
+        FROM
+            mdc_torque_config
+        WHERE
+            equipment_id = #{ equipmentId } AND torque_date BETWEEN #{ startTime } AND #{ endTime }
+        ORDER BY
+            torque_date ASC
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java
index c0f9a37..974d918 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java
@@ -3,10 +3,12 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
 import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -58,15 +60,6 @@
     Boolean deleteBatchTorque(String ids);
 
     /**
-     * 鐢熸垚涓昏酱杩愯鏇茬嚎
-     *
-     * @param torqueValue
-     * @return
-     */
-    List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId);
-
-
-    /**
      * 鍒嗛〉鏌ヨ
      *
      * @param userId
@@ -85,4 +78,14 @@
      * @return
      */
     ModelAndView exportXls(String userId, MdcTorqueConfig mdcTorqueConfig);
+
+    /**
+     * 鑾峰彇宸ヤ綔鏇茬嚎
+     * @param equipmentId
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime);
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
index fd58a96..fe773d0 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
@@ -9,6 +9,7 @@
 import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService;
 import org.jeecg.modules.mdc.service.IMdcEquipmentService;
 import org.jeecg.modules.mdc.service.IMdcEquipmentWorkLineService;
+import org.jeecg.modules.mdc.service.IMdcTorqueConfigService;
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdc.vo.MdcWorkChartVo;
 import org.springframework.stereotype.Service;
@@ -35,6 +36,9 @@
     @Resource
     private EquipmentWorklineMapper equipmentWorklineMapper;
 
+    @Resource
+    private IMdcTorqueConfigService mdcTorqueConfigService;
+
     /**
      * 鏌ユ壘鎸囧畾鏃ユ湡鐨勬暟鎹�
      */
@@ -49,7 +53,7 @@
             endTime = DateUtils.toDateMedium(mdcWorkChartVo.getDate() + " " + mdcWorkChartVo.getEnd() + ":00");
         }
 
-        if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > new Date().getTime())) {
+        if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > System.currentTimeMillis())) {
             return Collections.emptyList();
         }
         MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcWorkChartVo.getEquipmentId()));
@@ -66,6 +70,12 @@
             return null;
         }
         List<EquipmentMachingDto> result = this.getWorkLineList(saveTableName, mdcDriveTypeParamConfigs, mdcWorkChartVo, startTime, endTime);
+        // 鏌ユ壘鎵煩鍜岃繘缁欏弬鏁�
+        List<EquipmentMachingDto> torqueList = mdcTorqueConfigService.getWorkLineList(mdcWorkChartVo.getEquipmentId(), startTime, endTime);
+        if (torqueList != null && !torqueList.isEmpty()) {
+            result.addAll(torqueList);
+            result = result.stream().sorted(Comparator.comparing(EquipmentMachingDto::getCollectTime)).collect(Collectors.toList());
+        }
         if (result == null || result.isEmpty()) {
             return null;
         }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java
index 71682cb..3d5754d 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java
@@ -7,6 +7,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
 import org.jeecg.modules.mdc.entity.MdcEquipment;
 import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
 import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper;
@@ -20,10 +21,7 @@
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 /**
  * @Description: 鎵煩閰嶇疆绠$悊
@@ -75,11 +73,6 @@
     @Override
     public Boolean deleteBatchTorque(String ids) {
         return this.removeBatchByIds(Arrays.asList(ids.split(",")));
-    }
-
-    @Override
-    public List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId) {
-        return this.baseMapper.findSpindleRunningCurve(torqueValue, equipmentId);
     }
 
     @Override
@@ -178,4 +171,9 @@
         mv.addObject(NormalExcelConstants.DATA_LIST, mdcTorqueConfigs);
         return mv;
     }
+
+    @Override
+    public List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime) {
+        return this.baseMapper.getWorkLineList(equipmentId, startTime, endTime);
+    }
 }

--
Gitblit v1.9.3