From 074ae903cb6aed0b0dc9124d470efdf201360531 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 31 Dec 2024 17:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RepairServiceImpl.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index ddd05cd7..d06727f8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -243,7 +243,7 @@ public class RepairServiceImpl implements RepairService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult submitRepairApply(@NotNull(message = "参数不能为空") RepairApplyRecord bean) { - if (bean == null || bean.getRepairType() == null) { + if (null == bean || null == bean.getRepairType()) { return AjaxResult.error("维修方式参数不能为空"); } @@ -280,7 +280,7 @@ public class RepairServiceImpl implements RepairService { case TO_SCRAP: { BigDecimal scrapNum = details.getScrapNum().add(bean.getScrapNum()); BigDecimal totalNum = scrapNum.add(details.getRepairedNum()); - if (totalNum.compareTo(details.getRepairNum()) > 0) { + if (0 < totalNum.compareTo(details.getRepairNum())) { throw new ServiceException("维修数量大于维修总量"); } // 更新报废数量 @@ -297,9 +297,9 @@ public class RepairServiceImpl implements RepairService { if (Objects.equals(RepairTypeEnum.INNER_REPAIR.getTypeId(), bean.getRepairType())) { // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { - if (partDetails.getPartId() != null) { + if (null != partDetails.getPartId()) { // 有维修配件时,如果价格为空,设置为0 - if (partDetails.getPartCost() == null) { + if (null == partDetails.getPartCost()) { partDetails.setPartCost(BigDecimal.ZERO); } partDetails.setTaskId(bean.getTaskId()) @@ -334,12 +334,12 @@ public class RepairServiceImpl implements RepairService { bean.setPartName(partList.get(0).getPartName()); bean.setPartType(partList.get(0).getPartType()); bean.setRepairContent(partList.get(0).getRepairContent()); - if (partList.get(0).getSupplierId() == null) { + if (null == partList.get(0).getSupplierId()) { throw new ServiceException("请选择返厂厂家"); } else { bean.setSupplierId(partList.get(0).getSupplierId()); } - bean.setPartPrice(partList.get(0).getPartPrice() == null ? BigDecimal.ZERO : partList.get(0).getPartPrice()); + bean.setPartPrice(null == partList.get(0).getPartPrice() ? BigDecimal.ZERO : partList.get(0).getPartPrice()); bean.setPartNum(partList.get(0).getPartNum()); // 新增【维修记录表】 repairMapper.addRecord(bean); @@ -363,16 +363,16 @@ public class RepairServiceImpl implements RepairService { * 校验维修数量 */ private static BigDecimal verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) { - if (bean == null || bean.getRepairNum() == null) { + if (null == bean || null == bean.getRepairNum()) { throw new ServiceException("维修数量不能为空"); } - if (details.getRepairedNum() == null) { + if (null == details.getRepairedNum()) { details.setRepairedNum(BigDecimal.ZERO); } - if (details.getScrapNum() == null) { + if (null == details.getScrapNum()) { details.setScrapNum(BigDecimal.ZERO); } - if (details.getRepairNum() == null) { + if (null == details.getRepairNum()) { details.setRepairNum(BigDecimal.ZERO); } BigDecimal repairNum = details.getRepairedNum().add(bean.getRepairNum()) ; @@ -822,7 +822,7 @@ public class RepairServiceImpl implements RepairService { List detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId); BigDecimal thisRepairedNum = detailsList.stream().map(RepairTaskDetails::getRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal thisScrapNum = detailsList.stream().map(RepairTaskDetails::getScrapNum).reduce(BigDecimal.ZERO, BigDecimal::add); - if (!CollectionUtils.isEmpty(detailsList) && (thisRepairedNum.add(thisScrapNum)).compareTo(BigDecimal.ZERO) > 0) { + if (!CollectionUtils.isEmpty(detailsList) && 0 < (thisRepairedNum.add(thisScrapNum)).compareTo(BigDecimal.ZERO)) { task.setCreateBy(loginUser.getUserid()); Long agreementId = repairMapper.getAgreementId(task); // 新增tm_task表数据、修饰审核任务、状态是待审核