From 07982d9b169c1200fad9d544e4bf6e82398bac68 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Mon, 15 Jan 2024 15:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BD=8D=E6=9C=BA=E6=8A=A5=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/open/service/impl/OpenServiceImpl.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java index 198a5f2d..7d95891b 100644 --- a/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java +++ b/op-modules/op-open/src/main/java/com/op/open/service/impl/OpenServiceImpl.java @@ -276,25 +276,38 @@ public class OpenServiceImpl implements OpenService { @Override public AjaxResult machineRepair(EquRepairOrderDTO equRepairOrderDTO) { + if (equRepairOrderDTO.getFactory() == null) { + return error("工厂源不可为空!"); + } DynamicDataSourceContextHolder.push("ds_" + equRepairOrderDTO.getFactory());// 这是数据源的key // 创建报修单 DeviceRepairOrder equRepairOrder = new DeviceRepairOrder(); // 获取故障报修流水号 String serialNum = String.format("%03d", openMapper.selectOrderCodeSerialNumber()); + if (equRepairOrderDTO.getEquipmentCode() == null) { + return error("设备信息不可为空!"); + } equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairOrderDTO.getEquipmentCode() + serialNum);// 报修单号 equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());// id equRepairOrder.setEquipmentCode(equRepairOrderDTO.getEquipmentCode()); equRepairOrder.setOrderSource("上位机");// 故障来源 equRepairOrder.setOrderTime(DateUtils.getNowDate());// 报修时间 equRepairOrder.setOrderBreakdownTime(DateUtils.getNowDate());// 故障时间 - equRepairOrder.setOrderRepairmanCode(equRepairOrderDTO.getUserName());// 用户账号 - equRepairOrder.setOrderRepairmanName(equRepairOrderDTO.getUserNickName());// 用户名称 + if (equRepairOrderDTO.getUserName() != null) { + equRepairOrder.setOrderRepairmanCode(equRepairOrderDTO.getUserName());// 用户账号 + } + if (equRepairOrderDTO.getUserNickName() != null) { + equRepairOrder.setOrderRepairmanName(equRepairOrderDTO.getUserNickName());// 用户名称 + } + equRepairOrder.setCreateTime(DateUtils.getNowDate()); equRepairOrder.setCreateBy(equRepairOrderDTO.getUserName()); equRepairOrder.setOrderStatus("待审核");// 报修单状态 equRepairOrder.setFactoryCode(equRepairOrderDTO.getFactory());// 工厂 - equRepairOrder.setOrderConnection(equRepairOrderDTO.getPhoneNumber());// 联系方式 + if (equRepairOrderDTO.getPhoneNumber() != null) { + equRepairOrder.setOrderConnection(equRepairOrderDTO.getPhoneNumber());// 联系方式 + } openMapper.insertEquRepairOrder(equRepairOrder);