diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java index 096a8849..eff308f3 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java @@ -190,4 +190,6 @@ public interface EquOrderMapper { //获取组线信息 String getGroupLine(String auxiliaryEquipmentCode); + + String selectEquipment(String equipmentCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java index 3bed1b98..23528ba1 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java @@ -11,6 +11,7 @@ import java.util.stream.Collectors; import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.domain.BaseFileData; +import com.op.common.core.exception.ServiceException; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; @@ -249,6 +250,12 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { @Override @DS("#header.poolName") public int checkEquRepairOrder(EquRepairOrder equRepairOrder) { + //查询设备是否存在 + String equipment = equOrderMapper.selectEquipment(equRepairOrder.getEquipmentCode()); + if(StringUtils.isBlank(equipment)){ + throw new ServiceException("该设备不存在,请联系系统相关人员。"); + } + String code = equRepairOrder.getOrderCode().substring(10); //不生成流水号,从报修单号第十位开始切割、拼接 String workCode = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + code; if (equRepairOrder.getOrderSource().equals("点检") || equRepairOrder.getOrderSource().equals("巡检")) { //判断是否是点检、巡检过来的 diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml index 2f4f953b..c77d63b1 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml @@ -300,6 +300,10 @@ select equipment_name AS 'equipmentName' from base_equipment where equipment_code = #{equipmentCode} and del_flag = '0' + + insert into equ_order