From 8dd96c485f02fe82f12f21ba72509ac07b0b6449 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期二, 12 九月 2023 18:11:47 +0800
Subject: [PATCH] 预测性维护工单

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java            |    2 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java         |    3 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml         |   43 +++++++++++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java                  |   25 ++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java    |   31 ++++-----------
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java |    5 +-
 6 files changed, 81 insertions(+), 28 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
index 5d8456a..dae24cf 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
@@ -12,7 +12,9 @@
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.eam.entity.Equipment;
 import org.jeecg.modules.eam.entity.MaintenanceOrderActualWorkingHour;
+import org.jeecg.modules.eam.entity.PredictiveWorkOrder;
 import org.jeecg.modules.eam.entity.SpecialtyMaintenanceOrder;
 import org.jeecg.modules.eam.service.IMaintenanceOrderActualWorkingHourService;
 import org.jeecg.modules.eam.service.IPredictiveWorkOrderService;
@@ -66,29 +68,12 @@
      * 2023-4-25 qsw
      */
     @GetMapping(value = "/pageOrderList")
-    public Result<?> pageOrderList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) {
-        IPage<Map<String, Object>> specialtyMaintenanceOrderList = predictiveWorkOrderService.pageOrderList(pageNo, pageSize, params);
-//        for (Map<String, Object> record : specialtyMaintenanceOrderList.getRecords()) {
-//            String id = (String) record.get("id");
-//
-//            QueryWrapper<MaintenanceOrderActualWorkingHour> actualWorkingHourWrapper = new QueryWrapper<>();
-//            actualWorkingHourWrapper.eq("maintenance_order_id", id)
-//                    .eq("del_flag", 0);
-//            actualWorkingHourWrapper.select("sum(actual_working_hour_quota) as actualQuantity");
-//            Map<String, Object> map = maintenanceOrderActualWorkingHourService.getMap(actualWorkingHourWrapper);
-//            BigDecimal actualQuantity = new BigDecimal(0);
-//            if (map != null) {
-//                actualQuantity = (BigDecimal) map.get("actualQuantity");
-//            }
-//            record.put("actualWorkingHourQuota", actualQuantity);
-//
-//            String status = (String) record.get("status");
-//            if ("2".equals(status)) {
-//                record.put("distable", false);
-//            } else {
-//                record.put("distable", true);
-//            }
-//        }
+    public Result<?> pageOrderList(PredictiveWorkOrder predictiveWorkOrder,
+                                   @RequestParam(name = "pageNo", defaultValue="1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue="10") Integer pageSize,
+                                   HttpServletRequest req) {
+        Page<PredictiveWorkOrder> page = new Page<PredictiveWorkOrder>(pageNo, pageSize);
+        IPage<PredictiveWorkOrder> specialtyMaintenanceOrderList = predictiveWorkOrderService.pageOrderList(page,predictiveWorkOrder);
         return Result.ok(specialtyMaintenanceOrderList);
     }
 
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
index 9fcef22..64c8f83 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.eam.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -8,6 +9,7 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.entity.JeecgEntity;
 import org.jeecgframework.poi.excel.annotation.Excel;
@@ -16,6 +18,9 @@
 import java.io.Serializable;
 import java.util.Date;
 
+/**
+ * @author hlnl
+ */
 @Data
 @TableName("mom_eam_predictive_work_order")
 @Accessors(chain = true)
@@ -135,4 +140,24 @@
 
     private String itemId;
 
+    @TableField(exist = false)
+    @Dict(dicCode = "monitor_type")
+    private String monitorType;
+    @TableField(exist = false)
+    private String planNum;
+    @TableField(exist = false)
+    @Dict(dictTable = "mom_base_team",dicCode = "id",dicText = "name")
+    private String teamId;
+    @TableField(exist = false)
+    private String version;
+    @TableField(exist = false)
+    private String equipmentNum;
+    @TableField(exist = false)
+    private String equipmentName;
+    @TableField(exist = false)
+    private String model;
+    @TableField(exist = false)
+    @Dict(dicText = "depart_name",dicCode = "id",dictTable = "sys_depart")
+    private String useId;
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
index 45327c7..32cf850 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
@@ -12,7 +12,7 @@
 
 public interface PredictiveWorkOrderMapper extends BaseMapper<PredictiveWorkOrder> {
 
-    public IPage<Map<String, Object>> pageOrderList(IPage<Map> pageData,@Param("params")  Map<String, Object> params);
+    public List<PredictiveWorkOrder> pageList(IPage<PredictiveWorkOrder> pageData,@Param("num")String num);
 
     @Select("<script> select dbo.F_GET_SEQ_ID('${predictiveWorkOrder}') </script>")
     public String getOrderNum(@Param("predictiveWorkOrder")String predictiveWorkOrder);
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
index b5e8b95..2754f9e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
@@ -45,4 +45,47 @@
         </if>
         ORDER BY t1.create_time desc
     </select>
+    <select id="pageList" resultType="org.jeecg.modules.eam.entity.PredictiveWorkOrder">
+        select
+        t1.id id,
+        t1.num num,
+        t1.item_id itemId,
+        t1.actual_start_time actualStartTime,
+        t1.actual_end_time actualEndTime,
+        t1.plan_start_time planStartTime,
+        t1.plan_end_time planEndTime,
+        t1.create_by createBy,
+        t1.create_time createTime,
+        t1.maintenance_user_id maintenanceUserId,
+        t2.monitor_type monitorType,
+        t2.num planNum,
+        t2.team_id teamId,
+        t2.plan_version version,
+        t2.assign_mode assignMode,
+        t3.num equipmentNum,
+        t3.name equipmentName,
+        t3.model model,
+        t3.use_id useId,
+        t6.actualWorkingHourQuota actualWorkingHourQuota
+        from
+        mom_eam_predictive_work_order t1
+        left join (select * from mom_eam_predictive_work_plan where del_flag = 0) t2
+        on t1.work_plan_id = t2.id
+        left join (select * from mom_eam_equipment where del_flag = 0) t3
+        on t1.equipment_id = t3.id
+        left join
+        (select
+        t4.id,
+        ISNULL(SUM(t5.actual_working_hour_quota),0) actualWorkingHourQuota
+        from
+        mom_eam_predictive_work_order t4
+        left join mom_eam_maintenance_order_actual_working_hour t5
+        on t4.id = t5.maintenance_order_id
+        group by t4.id) t6
+        on t6.id = t1.id
+        where t1.del_flag = 0
+        <if test="num != null and num != ''">
+            and t1.num like concat('%',#{num},'%')
+        </if>
+    </select>
 </mapper>
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
index 86d6cfa..d887453 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.eam.service;
 
 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.eam.entity.PredictiveWorkOrder;
 
@@ -8,7 +9,7 @@
 
 public interface IPredictiveWorkOrderService extends IService<PredictiveWorkOrder> {
 
-    public IPage<Map<String, Object>> pageOrderList(Integer pageNo, Integer pageSize, Map<String, Object> params);
+    public IPage<PredictiveWorkOrder> pageOrderList(Page<PredictiveWorkOrder> page, PredictiveWorkOrder predictiveWorkOrder);
 
     /**
      *鏂板 宸ュ崟
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
index d2ca4c5..3df998e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
@@ -23,9 +23,8 @@
 public class PredictiveWorkOrderServiceImpl extends ServiceImpl<PredictiveWorkOrderMapper, PredictiveWorkOrder> implements IPredictiveWorkOrderService {
 
     @Override
-    public IPage<Map<String, Object>> pageOrderList(Integer pageNo, Integer pageSize, Map<String, Object> params) {
-        IPage<Map> pageData = new Page<Map>(pageNo, pageSize);
-        return super.getBaseMapper().pageOrderList(pageData, params) ;
+    public IPage<PredictiveWorkOrder> pageOrderList(Page<PredictiveWorkOrder> page, PredictiveWorkOrder predictiveWorkOrder) {
+        return page.setRecords(baseMapper.pageList(page,predictiveWorkOrder.getNum()));
     }
 
 //    @Autowired

--
Gitblit v1.9.3