diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/BaseSupplierService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/BaseSupplierService.java index 14561d3f..d1cdc73d 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/BaseSupplierService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/BaseSupplierService.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.supplier.service; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; @@ -9,8 +8,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import javax.validation.Valid; - /** * 供应商 Service 接口 * @@ -28,6 +25,15 @@ public interface BaseSupplierService extends IService { **/ void saveBaseSupplier(BaseSupplierSaveReqVO saveReqVO); + /** + * 生成采购单选择供应商 + * @author PQZ + * @date 17:43 2024/10/25 + * @param supplierName 供应商名称 + * @return java.lang.String + **/ + String appSaveSupplier(String supplierName); + /** * 删除供应商信息 * diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/impl/BaseSupplierServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/impl/BaseSupplierServiceImpl.java index efc297cb..e2c686ed 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/impl/BaseSupplierServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/supplier/service/impl/BaseSupplierServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.supplier.service.impl; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount; import cn.iocoder.yudao.module.supplier.mapper.BaseSupplierMapper; @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.supplier.service.BaseSupplierService; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -51,6 +52,30 @@ public class BaseSupplierServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(BaseDO::getDeleted,0).eq(BaseSupplier::getName,supplierName); + List list = list(lambdaQueryWrapper); + if (!list.isEmpty()){ + //存在供应商 + return list.get(0).getId(); + } else { + BaseSupplier supplier = new BaseSupplier(); + supplier.setName(supplierName); + save(supplier); + return supplier.getId(); + } + } + /** * 删除供应商信息 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java index b6d55a38..8a8ba885 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java @@ -47,8 +47,8 @@ public class DlRepairSoController { * 采购单/领料单新增分页 * * @param repairSoReqVO 查询对象 - * @param pageNo 页码 - * @param pageSize 条数 + * @param pageNo 页码 + * @param pageSize 条数 * @author 小李 * @date 18:14 2024/9/14 **/ @@ -64,10 +64,10 @@ public class DlRepairSoController { /** * 采购单/领料单 作废 * + * @param repairSoReqVO 作废对象 * @author 小李 * @date 11:12 2024/9/18 - * @param repairSoReqVO 作废对象 - **/ + **/ @PostMapping("/void") @Operation(summary = "采购单/领料单 作废") public CommonResult voidRepairSo(@RequestBody DlRepairSoReqVO repairSoReqVO) { @@ -78,26 +78,26 @@ public class DlRepairSoController { /** * 采购单/领料单 查看 * + * @param id 主键 * @author 小李 * @date 9:34 2024/9/22 - * @param id 主键 - **/ + **/ @GetMapping("/get") @Operation(summary = "采购单/领料单 查看") - public CommonResult getRepairSoById(@RequestParam("id") String id){ + public CommonResult getRepairSoById(@RequestParam("id") String id) { return success(dlRepairSoService.getRepairSoById(id)); } /** * 员工确认领料 * + * @param id 单据ID 领料单主表 * @author 小李 * @date 11:58 2024/10/21 - * @param id 单据ID 领料单主表 - **/ + **/ @GetMapping("/confirmGet") @Operation(summary = "员工确认领料") - public CommonResult confirmGet(@RequestParam("id") String id){ + public CommonResult confirmGet(@RequestParam("id") String id) { dlRepairSoService.confirmGet(id); return CommonResult.ok(); } @@ -105,15 +105,31 @@ public class DlRepairSoController { /** * 员工确认退料 * + * @param id 退料单主表ID * @author 小李 * @date 19:41 2024/10/21 - * @param id 退料单主表ID - **/ + **/ @GetMapping("/confirmBack") @Operation(summary = "员工确认退料") - public CommonResult confirmBack(@RequestParam("id") String id){ + public CommonResult confirmBack(@RequestParam("id") String id) { dlRepairSoService.confirmBack(id); return CommonResult.ok(); } + + + /** + * 采购入库 + * + * @param repairSoReqVO DlRepairSoReqVO实体 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 10:43 2024/10/25 + **/ + @PostMapping("/inWare") + @Operation(summary = "采购入库") + public CommonResult inWare(@RequestBody DlRepairSoReqVO repairSoReqVO) { + dlRepairSoService.inWare(repairSoReqVO); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 44536258..e9051a1d 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService; import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO; +import cn.iocoder.yudao.module.supplier.service.BaseSupplierService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; @@ -36,6 +37,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -91,6 +93,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl status = new ArrayList<>(); -// status.add("01"); // 待审核 -// status.add("05"); // 已驳回 -// // 查工单所有已通过的配件申请单 -// List list = ticketWaresService.list(new LambdaQueryWrapper().and(item -> { -// item.eq(DlTicketWares::getTicketId, respVO.getId()) -// .notIn(DlTicketWares::getStatus, status); -// })); -// // 查配件申请表的所有已领取数量小于申请数量的子表信息 -// List ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); -// List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { -// item.in(DlTwItem::getTwId, ids) -// .apply("wares_already_count < wares_count"); -// })); -// if (CollectionUtil.isNotEmpty(twItems)) { -// // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段) -// // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的)) -// List waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()); -// List items = titemService.list(new LambdaQueryWrapper().and(item -> { -// item.eq(DlRepairTitem::getTicketId, respVO.getId()) -// .eq(DlRepairTitem::getItemType, "02") -// .in(DlRepairTitem::getPartId, waresId); -// })); -// // 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件 -// items.stream().map(item -> { -// DlRepairTitem titem = new DlRepairTitem(); -// titem.setId(item.getId()); -// List wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); -// int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum(); -// -// }) -// } + // 先查满足条件的申请表 + ArrayList status = new ArrayList<>(); + status.add("01"); // 待审核 + status.add("05"); // 已驳回 + // 查工单所有已通过的配件申请单 + List list = ticketWaresService.list(new LambdaQueryWrapper().and(item -> { + item.eq(DlTicketWares::getTicketId, respVO.getId()) + .notIn(DlTicketWares::getStatus, status); + })); + // 查配件申请表的所有已领取数量小于申请数量的子表信息 + List ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); + List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { + item.in(DlTwItem::getTwId, ids) + .apply("wares_already_count < wares_count"); + })); + if (CollectionUtil.isNotEmpty(twItems)) { + // 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段) + // 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的)) + Set waresId = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toSet()); + List items = titemService.list(new LambdaQueryWrapper().and(item -> { + item.eq(DlRepairTitem::getTicketId, respVO.getId()) + .eq(DlRepairTitem::getItemType, "02") + .in(DlRepairTitem::getPartId, waresId); + })); + // 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件 + List updateItems = items.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setId(item.getId()); + List wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); + int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum(); + titem.setItemCount(sum); + BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount(); + titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(sum)).multiply(discount)); + return titem; + }).collect(Collectors.toList()); + + // 更新维修工单子表 + titemService.updateBatchById(updateItems); + + // 重新计算维修工单 + boolean flag = computeTicket(respVO.getId()); + if (!flag){ + throw exception0(500, "系统异常"); + } + } // 通知服务顾问 DlRepairTickets tickets = baseMapper.selectById(respVO.getId()); diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java index 98266bf1..6e944f66 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTicketWaresServiceImpl.java @@ -150,11 +150,11 @@ public class DlTicketWaresServiceImpl extends ServiceImpl result = new ArrayList<>(); //维修业务管理员、总检、服务顾问均可以进行审批 - if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())||userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){ + if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode()) || userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode()) || userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(DlTicketWares::getTicketId,reqVO.getTicketId()); - if (null != reqVO.getStatus()){ - lambdaQueryWrapper.eq(DlTicketWares::getStatus,reqVO.getStatus()); + lambdaQueryWrapper.eq(DlTicketWares::getTicketId, reqVO.getTicketId()); + if (null != reqVO.getStatus()) { + lambdaQueryWrapper.eq(DlTicketWares::getStatus, reqVO.getStatus()); } result = list(lambdaQueryWrapper); } @@ -194,7 +194,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl ids = permissionApi.getUserIdByRoleId(roleInfo.getId()); // 发通知 - if (CollectionUtil.isNotEmpty(ids)){ + if (CollectionUtil.isNotEmpty(ids)) { ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要审核")); } } @@ -241,18 +241,18 @@ public class DlTicketWaresServiceImpl extends ServiceImpl(); //配件没传,去库里面查需要的配件 - LambdaQueryWrapper queryWrapper= new LambdaQueryWrapper() - .eq(DlTwItem::getTwId,mainId); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(DlTwItem::getTwId, mainId); List applyList = twItemService.list(queryWrapper); - if(!applyList.isEmpty()){ + if (!applyList.isEmpty()) { //查配件库 List waresList = repairWaresService.listByIds(applyList.stream().map(DlTwItem::getWaresId).collect(Collectors.toList())); - Map waresMap =waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity())); + Map waresMap = waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity())); //组装工单子表数据 - for (DlTwItem item:applyList){ + for (DlTwItem item : applyList) { DlRepairTitem repairTitem = new DlRepairTitem(); repairTitem.setTicketId(ticketMainId); repairTitem.setItemCount(item.getWaresCount()); @@ -270,25 +270,53 @@ public class DlTicketWaresServiceImpl extends ServiceImpl() - // 工单子项总数量增加上配件的数量 - .setSql("count = count + " + repairItemList.size()) - // 工单配件总价 - .setSql("part_price = part_price + " + reduce) - // 工单总价 - .setSql("total_price = total_price + " + reduce) - // 参考成本 - .setSql("cost = cost + " + reduce) - // 参考毛利 - .setSql("profit = profit + " + reduce) - // 领料状态 - .set(DlRepairTickets::getPartStatus, "02") - .eq(DlRepairTickets::getId, ticketMainId) - ); - // 更新维修工单子表 - repairItemList.forEach(item -> { + // 这里是重新计算维修工单中的配件相关的信息,写了一个公共的重新计算工单的方法,替换掉 +// // 计算配件的总价 +// BigDecimal reduce = repairItemList.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add); +// repairTicketsService.update(new LambdaUpdateWrapper() +// // 工单子项总数量增加上配件的数量 +// .setSql("count = count + " + repairItemList.size()) +// // 工单配件总价 +// .setSql("part_price = part_price + " + reduce) +// // 工单总价 +// .setSql("total_price = total_price + " + reduce) +// // 参考成本 +// .setSql("cost = cost + " + reduce) +// // 参考毛利 +// .setSql("profit = profit + " + reduce) +// // 领料状态 +// .set(DlRepairTickets::getPartStatus, "02") +// .eq(DlRepairTickets::getId, ticketMainId) +// ); + // 更新维修工单子表----需要合并相同的配件,故修改 + // 先查维修工单的子表中的配件相关的信息 + List oldTitem = repairTitemService.list(new LambdaQueryWrapper().and(i -> i.eq(DlRepairTitem::getTicketId, ticketMainId).eq(DlRepairTitem::getItemType, "02"))); + // 过滤出新申请的配件里面有没有已经存在于工单子表的 + List waresIds = oldTitem.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList()); + List already = repairItemList.stream().filter(item -> waresIds.contains(item.getPartId())).collect(Collectors.toList()); + // 更新已经存在的配件 + if (CollectionUtil.isNotEmpty(already)) { + List updateItems = new ArrayList<>(); + already.forEach(item -> { + DlRepairTitem titem = oldTitem.stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().orElse(null); + if (titem != null) { + DlRepairTitem newItem = new DlRepairTitem(); + newItem.setId(titem.getId()); + newItem.setItemCount(titem.getItemCount() + item.getItemCount()); + // 如果设置了折扣就用,没有就是1 + BigDecimal itemDiscount = titem.getItemDiscount() == null ? new BigDecimal(1) : titem.getItemDiscount(); + // titem取价格、newItem取数量 + newItem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(newItem.getItemCount())).multiply(itemDiscount)); + updateItems.add(newItem); + } + }); + if (CollectionUtil.isNotEmpty(updateItems)) { + repairTitemService.updateBatchById(updateItems); + } + } + // 新增维修工单中没有的配件 + List newItems = repairItemList.stream().filter(item -> !waresIds.contains(item.getPartId())).collect(Collectors.toList()); + newItems.forEach(item -> { // 主表id item.setTicketId(ticketMainId); // 类型为配件 @@ -296,62 +324,76 @@ public class DlTicketWaresServiceImpl extends ServiceImpl ids = permissionApi.getUserIdByRoleId(roleInfo.getId()); - if (CollectionUtil.isNotEmpty(ids)){ + if (CollectionUtil.isNotEmpty(ids)) { ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理")); } - } else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")) { - // 如果通过退料,也需要更新 - // 更新维修工单 - // 计算配件的总价 - BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add); - repairTicketsService.update(new LambdaUpdateWrapper() - // 工单子项总数量增加上配件的数量 - .setSql("count = count - " + respVO.getWares().size()) - // 工单配件总价 - .setSql("part_price = part_price - " + reduce) - // 工单总价 - .setSql("total_price = total_price - " + reduce) - // 参考成本 - .setSql("cost = cost - " + reduce) - // 参考毛利 - .setSql("profit = profit - " + reduce) - // 领料状态 - .set(DlRepairTickets::getPartStatus, "02") - .eq(DlRepairTickets::getId, respVO.getTicketId()) - ); - // 维修工单子表对应的数据更新 - // 先查数据出来 - List list = repairTitemService.list(new LambdaQueryWrapper().and(i -> { - i.eq(DlRepairTitem::getTicketId, respVO.getTicketId()) - .in(DlRepairTitem::getPartId, respVO.getWares().stream().map(DlRepairTitem::getPartId).collect(Collectors.toList())); - })); - list.forEach(item -> { - respVO.getWares().stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().ifPresent(i -> { - // 如果只是退部分就减少数量 - if (!i.getItemCount().equals(item.getItemCount())) { - repairTitemService.update(new LambdaUpdateWrapper() - .setSql("item_count = item_count - " + i.getItemCount()) - .setSql("item_money = item_money - " + i.getItemMoney()) - .and(x -> { - x.eq(DlRepairTitem::getTicketId, respVO.getTicketId()).eq(DlRepairTitem::getPartId, item.getPartId()); - }) - ); - } else { - // 如果是全部退了,就直接删掉数据 - repairTitemService.removeById(item.getId()); - } - }); - }); - + } + // 如果是驳回,通知维修工 + if (status.equals("05")){ // 发送没有通过的消息给员工 DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了"); } + // 下面的代码为退料申请单通过的代码,但没有退料申请单,可以注掉,但防止有问题,所以先不删除 +// } else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")) { +// // 如果通过退料,也需要更新 +// // 更新维修工单 +// // 计算配件的总价 +// BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add); +// repairTicketsService.update(new LambdaUpdateWrapper() +// // 工单子项总数量增加上配件的数量 +// .setSql("count = count - " + respVO.getWares().size()) +// // 工单配件总价 +// .setSql("part_price = part_price - " + reduce) +// // 工单总价 +// .setSql("total_price = total_price - " + reduce) +// // 参考成本 +// .setSql("cost = cost - " + reduce) +// // 参考毛利 +// .setSql("profit = profit - " + reduce) +// // 领料状态 +// .set(DlRepairTickets::getPartStatus, "02") +// .eq(DlRepairTickets::getId, respVO.getTicketId()) +// ); +// // 维修工单子表对应的数据更新 +// // 先查数据出来 +// List list = repairTitemService.list(new LambdaQueryWrapper().and(i -> { +// i.eq(DlRepairTitem::getTicketId, respVO.getTicketId()) +// .in(DlRepairTitem::getPartId, respVO.getWares().stream().map(DlRepairTitem::getPartId).collect(Collectors.toList())); +// })); +// list.forEach(item -> { +// respVO.getWares().stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().ifPresent(i -> { +// // 如果只是退部分就减少数量 +// if (!i.getItemCount().equals(item.getItemCount())) { +// repairTitemService.update(new LambdaUpdateWrapper() +// .setSql("item_count = item_count - " + i.getItemCount()) +// .setSql("item_money = item_money - " + i.getItemMoney()) +// .and(x -> { +// x.eq(DlRepairTitem::getTicketId, respVO.getTicketId()).eq(DlRepairTitem::getPartId, item.getPartId()); +// }) +// ); +// } else { +// // 如果是全部退了,就直接删掉数据 +// repairTitemService.removeById(item.getId()); +// } +// }); +// }); +// +// // 发送没有通过的消息给员工 +// DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); +// repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了"); +// } } /** @@ -412,7 +454,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl oldData = twItemService.list(new LambdaQueryWrapper().in(DlTwItem::getId, respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList()))); // 构造新数据 List newData = oldData.stream().map(item -> { @@ -492,7 +534,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl list = respVO.getItems().stream().map(dlTwItem -> dlTwItem.setTwId(respVO.getId())).collect(Collectors.toList()); twItemService.saveBatch(list); } @@ -509,8 +551,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl getWorkerTodo() { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(DlTicketWares::getRepairId,loginUser.getId()) - .eq(DlTicketWares::getType,"01"); + .eq(DlTicketWares::getRepairId, loginUser.getId()) + .eq(DlTicketWares::getType, "01"); List list = this.list(queryWrapper); Map rtnMap = new HashMap<>(); //所有提交的 @@ -520,23 +562,23 @@ public class DlTicketWaresServiceImpl extends ServiceImpl