From eeafcc14cb790926edfb70a3dbf2e5608be5acae Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Fri, 20 Sep 2024 16:22:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/custom/vo/CarMainRespVO.java | 2 ++ .../resources/mapper/custom/CarMainMapper.xml | 1 + .../common/RepairErrorCodeConstants.java | 1 + .../admin/DlRepairTicketsController.java | 21 ++++++++++- .../admin/DlRepairTitemController.java | 2 +- .../tickets/entity/DlRepairTickets.java | 19 +++++++++- .../service/DlRepairTicketsService.java | 9 +++++ .../impl/DlRepairTicketsServiceImpl.java | 36 +++++++++++++++++++ .../tickets/vo/DlRepairTicketsRespVO.java | 6 ++++ .../mapper/tickets/DlRepairTicketsMapper.xml | 12 ++++++- .../src/main/resources/application.yaml | 2 +- 11 files changed, 106 insertions(+), 5 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java index 78d47c56..4678348c 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java @@ -42,4 +42,6 @@ public class CarMainRespVO extends CarMain { String bxCont; /**车辆品牌型号数组*/ List brandAndModel; + /** 车辆类型 */ + private String brandType; } \ No newline at end of file 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 b70414c2..a3a4dfd3 100644 --- a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml @@ -117,6 +117,7 @@ bcm.phone_number AS phoneNumber, bcb.brand_name AS brandStr, bcmm.model_name AS modelStr, + bcb.brand_type AS brand_type, DATEDIFF(tbcm.next_inspection_date, CURDATE()) AS njCont, DATEDIFF(tbcm.next_maintenance_date, CURDATE()) AS byCont, DATEDIFF(tbcm.insurance_expiry_date, CURDATE()) AS bxCont diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairErrorCodeConstants.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairErrorCodeConstants.java index c3de9b83..fe641e7a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairErrorCodeConstants.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairErrorCodeConstants.java @@ -9,4 +9,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; **/ public interface RepairErrorCodeConstants { ErrorCode GOODS_IS_EMPTY = new ErrorCode(500, "商品为空"); + ErrorCode ITEM_IS_EMPTY = new ErrorCode(500, "工单内容"); } 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 c5992f43..b9107a63 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 @@ -1,7 +1,12 @@ package cn.iocoder.yudao.module.tickets.controller.admin; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -13,12 +18,26 @@ import javax.annotation.Resource; * @date 18:21 2024/9/13 **/ @RestController -@RequestMapping("dlRepairTickets") +@RequestMapping("/repair/tickets") public class DlRepairTicketsController { /** * 服务对象 */ @Resource private DlRepairTicketsService dlRepairTicketsService; + + /** + * 维修工单表 新增 + * + * @author 小李 + * @date 11:33 2024/9/20 + * @param ticketsRespVO 新增对象 + **/ + @PostMapping("/create") + @Operation(summary = "维修工单表 新增") + public CommonResult createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO){ + dlRepairTicketsService.createTickets(ticketsRespVO); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java index 3f30a458..d901461e 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java @@ -14,7 +14,7 @@ import javax.annotation.Resource; * @date 18:21 2024/9/13 **/ @RestController -@RequestMapping("dlRepairTitem") +@RequestMapping("/repair/titem") public class DlRepairTitemController { /** * 服务对象 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java index cc0f3ccd..d0cb2f53 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + /** * 维修工单表 * @author 小李 @@ -131,4 +133,19 @@ public class DlRepairTickets extends TenantBaseDO { * 部门ID */ private Long deptId; -} \ No newline at end of file + + /** 工单子项的总数(每一个子项的数量) */ + private Integer count; + + /** 工单项目总价 */ + private BigDecimal projectPrice; + + /** 工单配件总价 */ + private BigDecimal partPrice; + + /** 工单其他总价 */ + private BigDecimal otherPrice; + + /** 工单总价 */ + private BigDecimal totalPrice; +} 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 10b46af8..0bed0861 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 @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.tickets.service; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; import com.baomidou.mybatisplus.extension.service.IService; /** @@ -11,4 +12,12 @@ import com.baomidou.mybatisplus.extension.service.IService; **/ public interface DlRepairTicketsService extends IService { + /** + * 维修工单表 新增 + * + * @author 小李 + * @date 11:33 2024/9/20 + * @param ticketsRespVO 新增对象 + **/ + void createTickets(DlRepairTicketsRespVO ticketsRespVO); } 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 40e23283..afaba428 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 @@ -1,11 +1,22 @@ package cn.iocoder.yudao.module.tickets.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.common.RepairErrorCodeConstants; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; +import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; +import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; + /** * 针对表【dl_repair_tickets(维修工单表)】的数据库操作Service实现 * @@ -16,6 +27,31 @@ import org.springframework.stereotype.Service; public class DlRepairTicketsServiceImpl extends ServiceImpl implements DlRepairTicketsService { + @Resource + private DlRepairTitemService titemService; + + /** + * 维修工单表 新增 + * + * @author 小李 + * @date 11:33 2024/9/20 + * @param ticketsRespVO 新增对象 + **/ + @Override + public void createTickets(DlRepairTicketsRespVO ticketsRespVO){ + // 新增主表 + baseMapper.insert(ticketsRespVO); + + // 新增子表 + if (CollectionUtil.isEmpty(ticketsRespVO.getItemList())){ + throw exception(RepairErrorCodeConstants.ITEM_IS_EMPTY); + } + List itemList = ticketsRespVO.getItemList(); + itemList.forEach(item -> { + item.setTichetId(ticketsRespVO.getId()); + }); + titemService.saveBatch(itemList); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java index 6849bce1..9281bd20 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsRespVO.java @@ -1,8 +1,11 @@ package cn.iocoder.yudao.module.tickets.vo; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; +import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import lombok.Data; +import java.util.List; + /** * 维修工单表 响应VO * @author 小李 @@ -10,4 +13,7 @@ import lombok.Data; **/ @Data public class DlRepairTicketsRespVO extends DlRepairTickets { + + /** 子表数组 */ + private List itemList; } diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml index 9fc13379..be4b3493 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -28,6 +28,11 @@ + + + + + @@ -53,7 +58,12 @@ remark, ticket_type, corp_id, - dept_id + dept_id, + count, + project_price, + part_price, + other_price, + total_price from dl_repair_tickets drt where drt.deleted = '0' diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index e51a786b..ff6900d0 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -68,7 +68,7 @@ flowable: mybatis-plus: configuration: map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。