From 5da4a45e7dbc71ca4f67378c54e9cec749ac5480 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Sat, 16 Nov 2024 15:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=BE=E9=97=AE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=AE=A2=E6=88=B7=E5=8F=96=E8=BD=A6=E5=89=8D=EF=BC=8C?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=A1=B9=E7=9B=AE=E4=BB=B7=E6=A0=BC=E3=80=81?= =?UTF-8?q?=E9=85=8D=E4=BB=B6=E4=BB=B7=E6=A0=BC=E6=98=AF=E5=90=A6=E5=B7=B2?= =?UTF-8?q?=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/DlRepairTicketsController.java | 13 +++ .../service/DlRepairTicketsService.java | 9 +++ .../impl/DlRepairTicketsServiceImpl.java | 79 ++++++++++++------- 3 files changed, 73 insertions(+), 28 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java index 2332f8d5..73ca7be2 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java @@ -336,6 +336,19 @@ public class DlRepairTicketsController { return CommonResult.ok(); } + /** + * 判断是否工单子表的任何一个类目没有价格或价格为0 + * + * @param id 工单ID + * @author 小李 + * @date 15:00 2024/11/16 + **/ + @GetMapping("/hasPrice") + @Operation(summary = "判断是否工单子表的任何一个类目没有价格或价格为0") + public CommonResult hasPrice(@RequestParam("id")String id){ + return success(dlRepairTicketsService.hasPrice(id)); + } + /** * 新增工单子项 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index f7d0f273..9fa5ff7a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -243,4 +243,13 @@ public interface DlRepairTicketsService extends IService { * @param respVO **/ void overOrder(DlRepairTicketsRespVO respVO); + + /** + * 判断是否工单子表的任何一个类目没有价格或价格为0 + * + * @param id 工单ID + * @author 小李 + * @date 15:00 2024/11/16 + **/ + Boolean hasPrice(String id); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 2c080f98..da45cb17 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -222,7 +222,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { item.setTicketId(ticketsRespVO.getId()); - if(null==item.getSaleId()){ + if (null == item.getSaleId()) { //默认销售人员是当前用户 item.setSaleId(loginUser.getId()); item.setSaleName(loginUser.getInfo().get("nickname")); @@ -415,7 +414,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() .set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode()) @@ -1007,16 +1006,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = repairWorkerService.list(); //查询当前工单下所有项目 LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(DlRepairTitem::getTicketId,ticketId); + lambdaQueryWrapper.eq(DlRepairTitem::getTicketId, ticketId); List itemList = titemService.list(lambdaQueryWrapper); //过滤出不包括当前指派人的值 List filterList = itemList.stream().filter(item -> !item.getRepairNames().contains(nowRepairName)).collect(Collectors.toList()); List saveList = new ArrayList<>(); //当前处理人工作组 - Map workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker)); + Map workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId, worker -> worker)); String workType = workerMap.get(nowRepairId).getWorkType(); filterList.forEach(item -> { //深拷贝 - DlRepairTitem saveItem = BeanUtils.toBean(item,DlRepairTitem.class); - if (StringUtils.isNotEmpty(saveItem.getRepairIds())){ + DlRepairTitem saveItem = BeanUtils.toBean(item, DlRepairTitem.class); + if (StringUtils.isNotEmpty(saveItem.getRepairIds())) { //取出用户id List repairIds = Arrays.stream(saveItem.getRepairIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); repairIds.forEach(idItem -> { @@ -1062,7 +1062,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { - String newRepairId = item.getRepairIds()+","+nowRepairId; + String newRepairId = item.getRepairIds() + "," + nowRepairId; String newRepairName = item.getRepairNames() + "," + nowRepairName; item.setRepairIds(newRepairId); item.setRepairNames(newRepairName); @@ -1123,7 +1123,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1")); List dataList = dictDataApi.getDictDataList("repair_work_type"); @@ -1282,11 +1282,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() - // 因为完成状态需要在交车之后,所以注掉这个 + // 因为完成状态需要在交车之后,所以注掉这个 // .set(DlRepairTickets::getIsFinish, "1") - .setSql("now_repair_id = adviser_id") - .setSql("now_repair_name = adviser_name") - .eq(DlRepairTickets::getId, respVO.getId()) + .setSql("now_repair_id = adviser_id") + .setSql("now_repair_name = adviser_name") + .eq(DlRepairTickets::getId, respVO.getId()) ); boolean flag = syncTicketWaresToTicket(respVO.getId()); @@ -1468,6 +1468,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl titems = titemService.list(new LambdaQueryWrapper().in(DlRepairTitem::getTicketId, id)); + for (DlRepairTitem item : titems) { + // 如果有为空的,直接报错 + if (ObjectUtil.isEmpty(item.getItemPrice())) { + throw exception0(500, "工单中有项目或配件没有设置价格,请服务顾问填写项目价格,仓库填写配件价格"); + } + // 如果有为0的,那就提示,让操作人选择 + if (item.getItemPrice().equals(new BigDecimal("0.00"))){ + return false; + } + } + return true; + } + /** * 重新计算工单的一些数值,子表也要重新计算 * @@ -1714,7 +1737,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl