From abfcc953ea8c33acf651996f867eb0c16b9ea6dd Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 11 Nov 2024 10:03:13 +0800 Subject: [PATCH 1/9] 1 (cherry picked from commit 29939dc277cd50adebd92698801e20ec0ec83d7c) --- .../custom/service/impl/CustomerMainServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java index 93c60d2b..f21f34d3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java @@ -41,9 +41,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import static cn.iocoder.yudao.common.BaseConstants.*; import static cn.iocoder.yudao.common.DictBaseConstants.DICT_CUS_TYPE; @@ -120,7 +118,7 @@ public class CustomerMainServiceImpl extends ServiceImpl roleCodes = new HashSet<>(); - roleCodes.add(dict.getRemark()); - permissionApi.assignUserRole(userId, roleCodes); + //绑定角色----客户不设置角色 +// Set roleCodes = new HashSet<>(); +// roleCodes.add(dict.getRemark()); +// permissionApi.assignUserRole(userId, roleCodes); } /*3、保存客户主表信息*/ //暂时写死会员id TODO 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 2/9] =?UTF-8?q?=E6=94=B9=E9=85=8D=E4=BB=B6=E7=94=B3?= =?UTF-8?q?=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 连接的示例 From 26cc95e827cd6893cc23474690e2487bb282beff Mon Sep 17 00:00:00 2001 From: Vinjor Date: Tue, 12 Nov 2024 11:24:12 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=AF=A6=E6=83=85=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/custom/CarMainMapper.xml | 4 +- .../impl/RepairRecordsServiceImpl.java | 6 +-- .../impl/DlRepairTicketsServiceImpl.java | 2 +- .../mapper/base/RepairRecordsMapper.xml | 42 ++++++++++++++++--- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml index 11b4ffd0..6cffa5c4 100644 --- a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml @@ -85,12 +85,10 @@ SELECT , bcb.brand_name AS brandStr, - bcb.logo_img AS logoImg, - bcm.model_name AS modelStr + bcb.logo_img AS logoImg FROM `base_car_main` tbcm LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id - LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id WHERE tbcm.deleted = 0 AND diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index db3ad74a..fde8d479 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -26,8 +26,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD; - /** * 维修记录 Service 实现类 * @@ -106,10 +104,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen()); - item.setItemList(itemList); //相对路径按照“,”分隔 - item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(","))); + item.setImages(item.getItemList().stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(","))); }); return list; } 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 6f0b41ab..a4605b3e 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 @@ -342,7 +342,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl itemList = titemService.list(new LambdaQueryWrapper().eq(DlRepairTitem::getTicketId, id)); diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml index 83ecb10f..6b9f4cee 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairRecordsMapper.xml @@ -8,14 +8,43 @@ 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> - - SELECT main.*, - drt.item_name AS projectName + drt.item_name AS projectName, + drri.id AS item_id, + drri.record_id AS item_record_id, + drri.ticket_id AS item_ticket_id, + drri.repair_item_id AS item_repair_item_id, + drri.remark AS item_remark, + drri.image AS item_image, + drri.is_open AS item_is_open, + drri.create_time AS item_create_time FROM dl_repair_records main LEFT JOIN dl_repair_titem drt ON main.repair_item_id = drt.id AND drt.deleted = 0 + LEFT JOIN dl_repair_records_item drri ON main.id = drri.record_id - main.deleted = '0' + main.deleted = '0' AND drri.deleted = '0' AND main.ticket_id = #{entity.ticketId} @@ -28,8 +57,11 @@ AND main.type = #{entity.type} + + AND drri.is_open = #{entity.type} + - order by main.create_time desc + order by main.create_time desc,drri.create_time + From 3c3c173ff62118aeaa791ad10033a4e26577bd3e Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Tue, 12 Nov 2024 17:44:06 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=94=B9=E9=85=8D=E4=BB=B6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairSoServiceImpl.java | 6 +- .../module/tickets/entity/DlTicketWares.java | 2 +- .../impl/DlRepairTicketsServiceImpl.java | 17 +- .../impl/DlTicketWaresServiceImpl.java | 226 ++++++++---------- .../module/tickets/vo/DlTicketWaresReqVO.java | 2 +- .../mapper/tickets/DlTicketWaresMapper.xml | 42 ++-- 6 files changed, 133 insertions(+), 162 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 958c975f..6e420e7f 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 @@ -256,9 +256,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> { if (so.getSoType().equals("02")){ wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); - }else { - wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); } + // 采购改了入库逻辑,不能在这里扣库存 +// else { +// wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount()))); +// } }); newWares.add(wares); }); 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 259efddf..9c6f7e8c 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 @@ -60,7 +60,7 @@ public class DlTicketWares extends TenantBaseDO { /** 维修顾问name(system_user的nickname) */ private String adviserName; - /** 状态:01待审批、02已审批、03已驳回,ticket_wares_status */ + /** 状态:01待审批、02已审批,ticket_wares_status */ private String status; /** 备注 */ 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 6f0b41ab..1d78bf57 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 @@ -1244,20 +1244,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl status = new ArrayList<>(); - status.add("01"); // 待审核 - status.add("05"); // 已驳回 - // 查工单所有已通过的配件申请单 + // 先查满足条件的申请表---配件申请表现在只有待审批和已审批,并且其子表的数据也可能同时有两种情况 +// ArrayList status = new ArrayList<>(); +// status.add("01"); // 待审核 +// status.add("05"); // 已驳回 + // 查工单所有已通过的配件申请单----这里直接查全部 List list = ticketWaresService.list(new LambdaQueryWrapper().and(item -> { - item.eq(DlTicketWares::getTicketId, id) - .notIn(DlTicketWares::getStatus, status); + item.eq(DlTicketWares::getTicketId, id); +// .notIn(DlTicketWares::getStatus, status); })); if (CollectionUtil.isNotEmpty(list)) { - // 查配件申请表的所有已领取数量小于申请数量的子表信息 + // 查配件申请表的所有已领取数量小于申请数量的子表信息----这里需要加上一个条件,得是审核通过的才行 List ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { item.in(DlTwItem::getTwId, ids) + .eq(DlTwItem::getWaresStatus, "1") .apply("wares_already_count < wares_count"); })); if (CollectionUtil.isNotEmpty(twItems)) { 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 66e524db..9cd3c50e 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 @@ -9,6 +9,7 @@ import cn.iocoder.yudao.common.SoStatusEnum; import cn.iocoder.yudao.common.TicketsItemStatusEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairWorkerService; @@ -138,7 +139,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl { DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class); twItem.setTwId(ticketWares.getId()); - twItem.setWaresStatus("0"); + twItem.setWaresStatus(""); + twItem.setWaresAlreadyCount(0); return twItem; }).collect(Collectors.toList()); if (CollectionUtil.isEmpty(list)) { @@ -260,115 +261,87 @@ public class DlTicketWaresServiceImpl extends ServiceImpl repairItemList = respVO.getWares(); - DlTicketWares updateObj = this.getById(mainId); - String ticketMainId = updateObj.getTicketId(); - updateObj.setStatus(status); - this.updateById(updateObj); - // 如果是通过并且是领料就还需要把配件信息加入到工单中 - if (ObjectUtil.isNotEmpty(status) && status.equals("02")) { - // 更新维修工单 - if(null!=respVO.getRepairWaresList()){ - repairItemList= new ArrayList<>(); - //走的是更新配件库价格 - Map updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice)); - //更新配件库的价格 - List updateWaresList = new ArrayList<>(); - //去库里面查需要的配件 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(DlTwItem::getTwId, mainId); - List applyList = twItemService.list(queryWrapper); - 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())); - //组装工单子表数据 - for (DlTwItem item : applyList) { - DlRepairTitem repairTitem = new DlRepairTitem(); - repairTitem.setTicketId(ticketMainId); - repairTitem.setItemCount(item.getWaresCount()); - repairTitem.setItemName(item.getWaresName()); - repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit()); - //取前端传过来的销售价格 - repairTitem.setItemPrice(updateMap.get(item.getId())); - //默认不打折为1 - repairTitem.setItemDiscount(new BigDecimal(1)); - repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice())); - //类型是配件 - repairTitem.setItemType("02"); - repairTitem.setPartId(item.getWaresId()); - repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode()); - repairItemList.add(repairTitem); - //组装配件库更新价格 - RepairWares update = new RepairWares(); - update.setId(item.getWaresId()); - update.setPrice(updateMap.get(item.getId())); - updateWaresList.add(update); + // 取出前端操作的配件申请表的子项id + List twItemIds = respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList()); + // 查所有的子项 + List twItems = twItemService.listByIds(twItemIds); + // 取所有的配件信息 + List wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()); + List repairWares = repairWaresService.listByIds(wareIds); + // 更新配件申请表子表 + List newTwitems = twItemIds.stream().map(item -> { + DlTwItem twItem = new DlTwItem(); + twItem.setId(item); + twItem.setWaresStatus(status.equals("01") ? "1" : "0"); + twItem.setHandleId(SecurityFrameworkUtils.getLoginUserId()); + twItem.setHandleName(SecurityFrameworkUtils.getLoginUserNickname()); + return twItem; + }).collect(Collectors.toList()); + twItemService.updateBatchById(newTwitems); + // 更新配件申请主表 + List allTwitems = twItemService.list(new LambdaQueryWrapper().in(DlTwItem::getTwId, respVO.getId())); + List passTwitems = allTwitems.stream().filter(item -> item.getWaresStatus().equals("1") || item.getWaresStatus().equals("0")).collect(Collectors.toList()); + boolean isStatus = CollectionUtil.isNotEmpty(passTwitems) && passTwitems.size() == allTwitems.size(); + if (isStatus) { + baseMapper.update(new LambdaUpdateWrapper().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId())); + } + // 更新维修工单子表 + if (status.equals("01")) { + DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); + List titems = repairTitemService.list(new LambdaQueryWrapper().and(i -> { + i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId()) + .eq(DlRepairTitem::getItemType, "02"); + })); + // 要修改的 + List updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList()); + // 修改 + if (CollectionUtil.isNotEmpty(updateTitems)) { + List newTitems = updateTitems.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setId(item.getId()); + DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null); + if (twItem != null) { + titem.setItemCount(item.getItemCount() + twItem.getWaresCount()); + titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount())); } - } - if(!updateWaresList.isEmpty()){ - repairWaresService.updateBatchById(updateWaresList); - } - } - // 更新维修工单子表----需要合并相同的配件,故修改 - // 先查维修工单的子表中的配件相关的信息 - 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); - // 类型为配件 - item.setItemType("02"); - // 状态为未领料 - item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode()); - }); - repairTitemService.saveBatch(newItems); - - // 重新计算工单 - boolean flag = repairTicketsService.computeTicket(ticketMainId); - if (!flag) { - throw exception0(500, "系统异常"); - } - - // 更新仓库 - if (CollectionUtil.isNotEmpty(repairItemList)){ - List updateWares = repairItemList.stream().map(item -> { - RepairWares wares = new RepairWares(); - wares.setId(item.getPartId()); - wares.setPrice(item.getItemPrice()); - return wares; + return titem; }).collect(Collectors.toList()); - repairWaresService.updateBatchById(updateWares); + repairTitemService.updateBatchById(newTitems); + } + // 要新增的 + if (updateTitems.size() < wareIds.size()) { + List titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList()); + List newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList()); + // 新增 + List newTitems = newWares.stream().map(item -> { + DlRepairTitem titem = new DlRepairTitem(); + titem.setTicketId(ticketWares.getTicketId()); + titem.setItemType("02"); + titem.setItemName(item.getName()); + DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null); + titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0); + titem.setItemUnit(item.getUnit()); + titem.setItemPrice(item.getPrice() != null ? item.getPrice() : BigDecimal.ZERO); + titem.setItemDiscount(BigDecimal.ONE); + titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount())); + titem.setRepairIds(String.valueOf(ticketWares.getRepairId())); + titem.setRepairNames(ticketWares.getRepairName()); + titem.setSaleId(ticketWares.getAdviserId()); + titem.setSaleName(ticketWares.getAdviserName()); + titem.setPartId(item.getId()); + titem.setItemStatus("04"); + titem.setRemark(twItem != null ? twItem.getRemark() : null); + return titem; + }).collect(Collectors.toList()); + repairTitemService.saveBatch(newTitems); + } + + // 更新维修工单主表 + boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId()); + if (!flag) { + throw exception0(500, "重新计算工单错误"); } // 发送通过的消息给仓库 @@ -378,14 +351,12 @@ public class DlTicketWaresServiceImpl extends ServiceImpl repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理")); } } - // 如果是驳回,通知维修工 - if (status.equals("05")) { - // 发送没有通过的消息给员工 - DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); - repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了"); - } + // 通知维修工 + DlTicketWares ticketWares = baseMapper.selectById(respVO.getId()); + repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了")); + //插入记录 - repairRecordsService.saveRepairRecord(respVO.getTicketId(),null,RecordTypeEnum.SPPJSQD.getCode(),"审批配件申请单",null); + repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null); } /** @@ -450,14 +421,14 @@ public class DlTicketWaresServiceImpl extends ServiceImpl wares = repairWaresService.list(new LambdaQueryWrapper().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()))); - Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getName)); - String remarkStr=""; - for(DlRepairSoi item:respVO.getRepairSois()){ + Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName)); + String remarkStr = ""; + for (DlRepairSoi item : respVO.getRepairSois()) { //组装通知领取配件的文字 - if(!"".equals(remarkStr)){ - remarkStr +=";"; + if (!"".equals(remarkStr)) { + remarkStr += ";"; } - remarkStr += waresNameMap.get(item.getGoodsId())+"x"+item.getGoodsCount(); + remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount(); } if (type.equals("02")) { // 领料 // 构造新数据 @@ -472,8 +443,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl From bb70fcb97fb7e4601420aee2b72fca345d64fb11 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 13 Nov 2024 09:49:33 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=BE=E9=97=AE?= =?UTF-8?q?=E4=B8=8D=E5=81=9A=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E4=BB=96=E4=BB=AC=E4=B9=8B=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=83=BD=E5=A4=9F=E4=BA=92=E7=9B=B8=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=B9=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/service/impl/DlRepairTicketsServiceImpl.java | 4 ++-- .../tickets/service/impl/DlTicketWaresServiceImpl.java | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) 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 1a4c1845..83451994 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 @@ -856,8 +856,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl Date: Wed, 13 Nov 2024 09:49:34 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=95=91=E6=8F=B4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/CustomerMainController.java | 21 ++--- .../custom/service/CustomerCarService.java | 12 +++ .../service/impl/CustomerCarServiceImpl.java | 88 ++++++++++++++++++- .../custom/vo/CustomerMainSaveReqVO.java | 8 +- 4 files changed, 112 insertions(+), 17 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java index 3bba72f7..252a7cd8 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java @@ -1,12 +1,8 @@ package cn.iocoder.yudao.module.custom.controller.admin; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerCarService; import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; @@ -23,11 +19,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.net.ssl.HttpsURLConnection; import javax.validation.Valid; - -import java.net.HttpURLConnection; -import java.net.URL; import java.util.List; import static cn.iocoder.yudao.common.BaseConstants.*; @@ -48,7 +40,8 @@ public class CustomerMainController { private CustomerMainService customerMainService; @Resource private BusiLabelService busiLabelService; - + @Resource + private CustomerCarService customerCarService; /** * 客户管理分页列表查询 * @@ -85,6 +78,14 @@ public class CustomerMainController { return success(true); } + + @PostMapping("/saveCustomerAndCar") + @Operation(summary = "保存客户及车辆信息") + public CommonResult saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception { + customerCarService.saveCustomerAndCar(saveReqVO); + return success(true); + } + /** * 编辑客户 * diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java index 218231f8..75b63847 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerCarService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.custom.service; import cn.iocoder.yudao.module.custom.entity.CustomerCar; +import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -23,4 +24,15 @@ public interface CustomerCarService extends IService { * @date 18:45 2024/8/3 **/ void bindCustomerCar(String mainId, String mainTable, List customerCars); + + + + /** + * 保存客户及车辆信息 + * @author PQZ + * @date 15:51 2024/11/12 + * @param saveReqVO CustomerMainSaveReqVO + * @return void + **/ + void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception; } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java index 015b7c9b..5484f799 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerCarServiceImpl.java @@ -1,19 +1,32 @@ package cn.iocoder.yudao.module.custom.service.impl; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.custom.entity.CarMain; import cn.iocoder.yudao.module.custom.entity.CustomerCar; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper; +import cn.iocoder.yudao.module.custom.service.CarMainService; import cn.iocoder.yudao.module.custom.service.CustomerCarService; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; +import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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; import org.springframework.validation.annotation.Validated; +import javax.annotation.Resource; import java.util.List; -import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR; -import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER; +import static cn.iocoder.yudao.common.BaseConstants.*; +import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS; /** * 客户车辆管理关联 @@ -24,6 +37,15 @@ import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER; @Validated public class CustomerCarServiceImpl extends ServiceImpl implements CustomerCarService { + @Resource + @Lazy + private CustomerMainService customerMainService; + @Resource + @Lazy + private CarMainService carMainService; + @Resource + @Lazy + private AdminUserApi adminUserApi; /** * 保存客户与车辆的关联关系 @@ -60,4 +82,66 @@ public class CustomerCarServiceImpl extends ServiceImpl carList; /**标签信息*/ List labelList; - - /** - * 微信openId - */ - private String openId; + /**客户车辆信息*/ + private CarMain car; } \ No newline at end of file