From 35b354562b0ce8621ac1bbed03f2d31f81ae8f9d Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 25 Oct 2023 15:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=85=BB=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquUpkeepController.java | 12 +++++ .../java/com/op/device/domain/EquOrder.java | 33 ++++++++++++ .../op/device/mapper/EquCheckItemMapper.java | 3 +- .../op/device/service/IEquUpkeepService.java | 10 ++++ .../service/impl/EquPlanServiceImpl.java | 5 +- .../service/impl/EquUpkeepServiceImpl.java | 51 +++++++++++++++++++ .../mapper/device/EquCheckItemMapper.xml | 2 +- .../mapper/device/EquOrderMapper.xml | 17 ++++++- 8 files changed, 129 insertions(+), 4 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepController.java index 4b75cc3c..cf150095 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepController.java @@ -3,6 +3,7 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.op.device.domain.EquPlanEqu; import com.op.device.service.IEquUpkeepService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +35,17 @@ public class EquUpkeepController extends BaseController { @Autowired private IEquUpkeepService equUpkeepService; + /** + * 处理计划-设备信息 + * + * @param equPlanEquList + * @return + */ + @PostMapping("/formatEquItem") + public AjaxResult formatEquItem(@RequestBody List equPlanEquList) { + return equUpkeepService.formatEquItem(equPlanEquList); + } + /** * 查询保养计划列表 */ diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java index 3c894303..6f05277a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java @@ -131,6 +131,39 @@ public class EquOrder extends BaseEntity { private EquOrderEqu equ; + // 保养类型 + private String upkeep; + + // 计划保养时间计算规则 + private String calculationRule; + + // 是否停机保养 + private String shutDown; + + public String getShutDown() { + return shutDown; + } + + public void setShutDown(String shutDown) { + this.shutDown = shutDown; + } + + public String getCalculationRule() { + return calculationRule; + } + + public void setCalculationRule(String calculationRule) { + this.calculationRule = calculationRule; + } + + public String getUpkeep() { + return upkeep; + } + + public void setUpkeep(String upkeep) { + this.upkeep = upkeep; + } + public EquOrderEqu getEqu() { return equ; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java index cb2e59c0..2790b7ca 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.op.device.domain.EquCheckItem; import com.op.device.domain.EquPlanDetail; import com.op.device.domain.vo.EquCheckItemVO; +import org.apache.ibatis.annotations.Param; /** * 检查项维护Mapper接口 @@ -85,7 +86,7 @@ public interface EquCheckItemMapper { * @param equipmentCode * @return */ - List selectCheckItemByEquipmentCode(String equipmentCode); + List selectCheckItemByEquipmentCode(@Param("equipmentCode") String equipmentCode,@Param("type") String type); /** * 检验计划里是否有 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepService.java index 389e047a..de17e703 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepService.java @@ -3,7 +3,9 @@ package com.op.device.service; import java.util.List; +import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquPlan; +import com.op.device.domain.EquPlanEqu; /** * 保养计划Service接口 @@ -59,4 +61,12 @@ public interface IEquUpkeepService { * @return 结果 */ public int deleteEquPlanByPlanId(String planId); + + /** + * 处理计划-设备信息 + * + * @param equPlanEquList + * @return + */ + AjaxResult formatEquItem(List equPlanEquList); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java index 898437ca..4332ce55 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java @@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.success; /** @@ -241,7 +242,7 @@ public class EquPlanServiceImpl implements IEquPlanService { StringBuilder itemTempName = new StringBuilder(); // 获取检查项list - List equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode()); + List equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode(),"inspection"); if (equCheckItemList.size() > 0) { for (EquCheckItem checkItem : equCheckItemList) { if (!checkItem.getItemCode().isEmpty()) { @@ -258,6 +259,8 @@ public class EquPlanServiceImpl implements IEquPlanService { } data.setEquCheckItemList(equCheckItemList); data.setItemTempName(itemTempName.toString()); + }else { + return error(500,"存在设备未设置巡检项!"); } } return success(equPlanEquList); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java index a331c219..37949a9e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java @@ -2,7 +2,13 @@ package com.op.device.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; +import com.op.common.core.web.domain.AjaxResult; +import com.op.device.domain.EquCheckItem; +import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.EquPlan; +import com.op.device.domain.EquPlanEqu; +import com.op.device.mapper.EquCheckItemDetailMapper; +import com.op.device.mapper.EquCheckItemMapper; import com.op.device.mapper.EquPlanMapper; import com.op.device.service.IEquUpkeepService; import org.springframework.beans.factory.annotation.Autowired; @@ -10,11 +16,18 @@ import org.springframework.stereotype.Service; import java.util.List; +import static com.op.common.core.web.domain.AjaxResult.error; +import static com.op.common.core.web.domain.AjaxResult.success; + @Service public class EquUpkeepServiceImpl implements IEquUpkeepService { @Autowired private EquPlanMapper equPlanMapper; + @Autowired + private EquCheckItemMapper equCheckItemMapper; + @Autowired + private EquCheckItemDetailMapper equCheckItemDetailMapper; /** * 查询保养计划 @@ -89,4 +102,42 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService { public int deleteEquPlanByPlanId(String planId) { return equPlanMapper.deleteEquPlanByPlanId(planId); } + + /** + * 处理计划-设备信息 + * + * @param equPlanEquList + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult formatEquItem(List equPlanEquList) { + for (EquPlanEqu data : equPlanEquList) { + + StringBuilder itemTempName = new StringBuilder(); + + // 获取检查项list + List equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode(),"maintenance"); + if (equCheckItemList.size() > 0) { + for (EquCheckItem checkItem : equCheckItemList) { + if (!checkItem.getItemCode().isEmpty()) { + itemTempName.append(checkItem.getItemName()).append(","); + // 获取检查项详情list + List equCheckItemDetailList = equCheckItemDetailMapper.selectCheckItemDetailByItemCode(checkItem.getItemCode()); + if (equCheckItemList.size() > 0) { + for (EquCheckItemDetail detail : equCheckItemDetailList) { + detail.setShowFlag(true); + } + checkItem.setEquCheckItemDetailList(equCheckItemDetailList); + } + } + } + data.setEquCheckItemList(equCheckItemList); + data.setItemTempName(itemTempName.toString()); + }else { + return error(500,"存在设备未设置保养项!"); + } + } + return success(equPlanEquList); + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index 8f9380fc..8b9c288e 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -69,6 +72,9 @@ and create_time = #{createTime} and update_by like concat('%', #{updateBy}, '%') and update_time = #{updateTime} + and upkeep = #{upkeep} + and calculation_rule = #{calculationRule} + and shut_down = #{shutDown} and del_flag = '0' @@ -131,6 +137,9 @@ create_time, update_by, update_time, + upkeep, + calculation_rule, + shut_down, #{orderId}, @@ -161,6 +170,9 @@ #{createTime}, #{updateBy}, #{updateTime}, + #{upkeep}, + #{calculationRule}, + #{shutDown}, @@ -194,6 +206,9 @@ create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, + upkeep = #{upkeep}, + calculation_rule = #{calculationRule}, + shut_down = #{shutDown}, where order_id = #{orderId}