From 9221a7c503e995c4a3a35d6aa88f014ea3a07d63 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Tue, 12 Nov 2024 09:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=85=8D=E4=BB=B6=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairSoServiceImpl.java | 2 - .../controller/admin/DlTwItemController.java | 17 ---- .../module/tickets/entity/DlTicketWares.java | 47 +++++----- .../yudao/module/tickets/entity/DlTwItem.java | 46 ++++------ .../impl/DlTicketWaresServiceImpl.java | 92 ++++++++++++------- .../mapper/tickets/DlTicketWaresMapper.xml | 62 ++++++++----- .../mapper/tickets/DlTwItemMapper.xml | 34 ++++--- .../src/main/resources/application-local.yaml | 1 + 8 files changed, 160 insertions(+), 141 deletions(-) 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 0b82966c..958c975f 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 @@ -242,11 +242,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> { if (so.getSoType().equals("02")){ dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount()); - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoiByTwItem.getGoodsCount()); dlTwItem.setWaresStatus("02"); }else { dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount()); - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() - repairSoiByTwItem.getGoodsCount()); } }); newTwItems.add(dlTwItem); diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java index 20ad5e12..2880b57c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTwItemController.java @@ -41,22 +41,5 @@ public class DlTwItemController { public CommonResult listTwItem(DlTwItemReqVO reqVO){ return success(dlTwItemService.listTwItem(reqVO)); } - - /** - * 配件客户是否可见 - * - * @author 小李 - * @date 17:55 2024/10/15 - * @param reqVO 请求对象 - **/ - @GetMapping("/isShow") - @Operation(summary = "配件客户是否可见") - public CommonResult updateIsShow(DlTwItemReqVO reqVO){ - DlTwItem dlTwItem = new DlTwItem(); - dlTwItem.setIsShow(reqVO.getIsShow()); - dlTwItem.setId(reqVO.getId()); - dlTwItemService.updateById(dlTwItem); - return CommonResult.ok(); - } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java index d7538e15..259efddf 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTicketWares.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** * 工单配件申请/退回表 * @@ -17,34 +19,31 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) public class DlTicketWares extends TenantBaseDO { - /** - * 主键标识 - */ + + /** 主键标识 */ @TableId(type = IdType.ASSIGN_ID) private String id; - /** - * 单据号(自动生成) - */ + /** 单据号(自动生成) */ private String no; - /** - * 工单ID(dl_repair_tickets表的ID) - */ + /** 工单ID(dl_repair_tickets表的ID) */ private String ticketId; - /** - * 类型(01:领料,02:退料,ticket_wares_type) - */ - private String type; + /** 用户ID(dl_customer_main的userId) */ + private Long userId; - /** - * 状态(01:待审核,02已通过,03:全部完成,04:部分完成,05:已驳回,ticket_wares_status) - */ - private String status; + /** 用户名称(base_customer_main的cusName) */ + private String userName; - /** 备注 */ - private String remark; + /** 用户电话(base_customer_main的phoneNumber) */ + private String userMobile; + + /** 车辆ID(base_car_main的ID) */ + private String carId; + + /** 客户车辆的车牌号(dl_repair_tickets中的carNo) */ + private String licenseNumber; /** 发起人ID(dl_repair_worker的user_id) */ private Long repairId; @@ -52,12 +51,18 @@ public class DlTicketWares extends TenantBaseDO { /** 发起人name(dl_repair_worker的user_name) */ private String repairName; + /** 申请人岗位(dl_repair_worker的workType) */ + private String repairWork; + /** 维修顾问ID(system_users的ID) */ private Long adviserId; /** 维修顾问name(system_user的nickname) */ private String adviserName; - /** 客户车辆的车牌号(dl_repair_tickets中的carNo) */ - private String licenseNumber; + /** 状态:01待审批、02已审批、03已驳回,ticket_wares_status */ + private String status; + + /** 备注 */ + private String remark; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java index 6537f372..fb1b0351 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlTwItem.java @@ -21,49 +21,35 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = true) public class DlTwItem extends TenantBaseDO { - /** - * 主键标识 - */ + + /** 主键标识 */ @TableId(type = IdType.ASSIGN_ID) private String id; - /** - * 主表ID(dl_ticket_wares表的ID) - */ + /** 主表ID(dl_ticket_wares表的ID) */ private String twId; - /** - * 配件ID - */ + /** 配件ID */ private String waresId; - /** - * 配件名称 - */ + /** 配件名称 */ private String waresName; - /** - * 配件数量 - */ + /** 配件数量 */ private Integer waresCount; - /** - * 配件状态(01:已领料,02:未领料,03:已退料,04可确认领料,可确认退料 tw_item_status) - */ + /** 已领取数量 */ + private Integer waresAlreadyCount; + + /** 配件状态:使用字典yes_no,1通过,0没通过 */ private String waresStatus; + /** 审核人ID(system_users的ID) */ + private Long handleId; + + /** 审核人姓名(system_users的nickname) */ + private String handleName; + /** 备注 */ private String remark; - - /** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */ - private String isShow; - - /** 可领取数量 */ - private Integer waresCouldCount; - - /** 已领料数量 */ - private Integer waresAlreadyCount; - - /** 已退数量 */ - private Integer waresBackCount; } \ No newline at end of file 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 4c86ae7c..66e524db 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.tickets.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RecordTypeEnum; @@ -11,6 +12,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; @@ -99,6 +102,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); - respVO.setRepairId(one.getUserId()); - respVO.setRepairName(one.getUserName()); - baseMapper.insertOrUpdate(respVO); + DlTicketWares ticketWares = BeanUtil.toBean(respVO, DlTicketWares.class); + /* + 设置信息 + */ + // 用户信息 + DlRepairTickets tickets = repairTicketsService.getById(ticketWares.getTicketId()); + CustomerMain customerMain = customerMainService.getById(tickets.getUserId()); + ticketWares.setUserId(customerMain.getUserId()); + ticketWares.setUserName(customerMain.getCusName()); + ticketWares.setUserMobile(customerMain.getPhoneNumber()); + // 车辆信息 + ticketWares.setCarId(tickets.getCarId()); + ticketWares.setLicenseNumber(tickets.getCarNo()); + // 发起人信息 + RepairWorker worker = repairWorkerService.getOne(new LambdaQueryWrapper().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); + ticketWares.setRepairId(worker.getUserId()); + ticketWares.setRepairName(worker.getUserName()); + ticketWares.setRepairWork(worker.getWorkType()); + // 服务顾问信息 + ticketWares.setAdviserId(Long.valueOf(tickets.getAdviserId())); + ticketWares.setAdviserName(tickets.getAdviserName()); + + baseMapper.insertOrUpdate(ticketWares); + // 新增、修改子表 - List list = respVO.getItems().stream().map(item -> item.setTwId(respVO.getId())).collect(Collectors.toList()); + List list = respVO.getItems().stream() + .map(item -> { + DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class); + twItem.setTwId(ticketWares.getId()); + twItem.setWaresStatus("0"); + return twItem; + }).collect(Collectors.toList()); if (CollectionUtil.isEmpty(list)) { throw exception0(500, "配件列表为空"); } @@ -190,7 +222,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl(); @@ -443,10 +472,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl { // 取本来的已领取数量-本次要退料的数量 dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount()); - // 可领取数量就是上次的可领取+退料数量 - // item是操作的可领取数量,repairSoi是取本次退料的数量 - dlTwItem.setWaresCouldCount(item.getWaresCouldCount() + repairSoi.getGoodsCount()); // dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus()); // 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变 - dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresCouldCount()) ? "03" : "02"); + dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0"); }); return dlTwItem; }).collect(Collectors.toList()); @@ -537,21 +559,22 @@ public class DlTicketWaresServiceImpl extends ServiceImpl list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, respVO.getId())); - List list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList()); - respVO.setStatus(list1.size() == list.size() ? "03" : "04"); - baseMapper.updateById(respVO); - // 操作库存 - list.forEach(item -> { - repairWaresService.update(new LambdaUpdateWrapper() - .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount()) - .eq(RepairWares::getId, item.getWaresId()) - ); - }); + // todo +// // 更新领料申请子表 +// twItemService.updateBatchById(respVO.getItems()); +// // 更新领料申请表 +// // 判断是全部完成完成部分完成 +// List list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, respVO.getId())); +// List list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList()); +// respVO.setStatus(list1.size() == list.size() ? "03" : "04"); +// baseMapper.updateById(respVO); +// // 操作库存 +// list.forEach(item -> { +// repairWaresService.update(new LambdaUpdateWrapper() +// .setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount()) +// .eq(RepairWares::getId, item.getWaresId()) +// ); +// }); } /** @@ -601,8 +624,7 @@ 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()); List list = this.list(queryWrapper); Map rtnMap = new HashMap<>(); //所有提交的 diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml index 3269b989..7d44fb5d 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml @@ -5,30 +5,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + select - dtw.id as id,no,ticket_id, - type,status,dtw.remark as remark, - dtw.repair_id as repair_id, - dtw.repair_name as repair_name, - dtw.adviser_id as adviser_id, - dtw.adviser_name as adviser_name, - dtw.license_number as license_number, - dtw.create_time as create_time + dtw.id, + dtw.no, + dtw.ticket_id, + dtw.user_id, + dtw.user_name, + dtw.user_mobile, + dtw.car_id, + dtw.license_number, + dtw.repair_id, + dtw.repair_name, + dtw.repair_work, + dtw.adviser_id, + dtw.adviser_name, + dtw.status, + dtw.remark, + dtw.create_time from dl_ticket_wares dtw left join dl_repair_tickets drt on dtw.ticket_id = drt.id @@ -46,8 +58,14 @@ dtw.license_number like concat('%', #{map.query}, '%') ) - - and (dtw.type = #{map.type}) + + and dtw.license_number like concat('%', #{map.licenseNumber}, '%') + + + and dtw.user_mobile like concat('%', #{map.userMobile}, '%') + + + and dtw.repair_name like concat('%', #{map.repairName}, '%') and (dtw.status = #{map.status}) diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml index 39fbf92c..9200d38b 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml @@ -5,24 +5,30 @@ - - - - - - - - - - - + + + + + + + + + + select - id,tw_id,wares_id, - wares_name,wares_count,wares_status,remark, - is_show,wares_could_count, wares_already_count, wares_back_count + id, + tw_id, + wares_id, + wares_name, + wares_count, + wares_already_count, + wares_status, + handle_id, + handle_name, + remark from dl_tw_item dti where dti.deleted = '0' diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 1b9cd8ce..ae71216a 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -47,6 +47,7 @@ spring: datasource: master: url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 +# url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例