From c7eb922c721661effea34e542c118f6b99cc2454 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 8 Jan 2025 17:19:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/custom/entity/CarMain.java | 11 ++- .../yudao/module/tickets/entity/Tickets.java | 3 + .../service/impl/TicketsServiceImpl.java | 23 ++--- .../cn/iocoder/yudao/common/RepairCons.java | 2 + .../yudao/common/TicketsStatusEnum.java | 4 +- .../admin/DlRepairTicketsController.java | 75 ++++++++++++++++ .../admin/DlTicketWaresController.java | 17 ++++ .../tickets/entity/DlRepairTickets.java | 13 +++ .../module/tickets/entity/DlTicketWares.java | 4 +- .../impl/DlRepairTicketsServiceImpl.java | 89 ++++++++++++++----- .../mapper/tickets/DlRepairTicketsMapper.xml | 21 ++++- .../mapper/tickets/DlTicketWaresMapper.xml | 2 +- 12 files changed, 226 insertions(+), 38 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java index 94511e1f..0c553c98 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java @@ -147,5 +147,14 @@ public class CarMain extends TenantBaseDO { @ExcelProperty("最近业务时间") private LocalDateTime recentlyHandleBusinessTime; - + /** 保险公司名称 */ + private String insuranceName; + /** 承保险种,多个英文逗号隔开 */ + private String insuranceType; + /** 交强险保费 */ + private BigDecimal jiaoqiang; + /** 商业险保费 */ + private BigDecimal shangye; + /** 车龄 */ + private Double carYear; } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/Tickets.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/Tickets.java index 8c9af228..14b3632c 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/Tickets.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/Tickets.java @@ -180,4 +180,7 @@ public class Tickets extends TenantBaseDO { /** 工单完成情况(0:未完成,1:已完成) */ private String isFinish; + + /** 是否交车(0未交车|1已交车) */ + private String isHandover; } diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java index b6db061e..4fa7ec5c 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java @@ -4,7 +4,6 @@ import cn.iocoder.yudao.module.tickets.entity.Tickets; import cn.iocoder.yudao.module.tickets.mapper.TicketsMapper; import cn.iocoder.yudao.module.tickets.service.BaseRepairRecordsService; import cn.iocoder.yudao.module.tickets.service.TicketsService; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,7 +20,7 @@ public class TicketsServiceImpl extends ServiceImpl impl private BaseRepairRecordsService baseRepairRecordsService; /** - * 更新工单状态为已结账 + * 更新工单状态为已结账-----小程序结算工单 * 考虑可能有批量操作的情况,采用批量更新的方式 * * @author 小李 @@ -30,15 +29,17 @@ public class TicketsServiceImpl extends ServiceImpl impl **/ @Override public void updateTickets(List ticketIds){ - baseMapper.update(new LambdaUpdateWrapper() - .in(Tickets::getId, ticketIds) - .set(Tickets::getTicketsStatus, "02") - // 不在这儿结束 -// .set(Tickets::getIsFinish, "1") - ); - // 记录日志 - if(!ticketIds.isEmpty()){ - baseRepairRecordsService.saveRepairRecord(ticketIds.get(0), null, "js", "线上支付结算", null); + for (String id:ticketIds){ + Tickets tickets = this.getById(id); + if("1".equals(tickets.getIsHandover())){ + //已交车,已结算,那么需要把工单状态置为已完成 + tickets.setTicketsStatus("08"); + tickets.setIsFinish("1"); + }else{ + tickets.setTicketsStatus("02"); + } + this.updateById(tickets); + baseRepairRecordsService.saveRepairRecord(id, null, "js", "线上支付结算", null); } } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java index f5ec35cc..af9d8a3d 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairCons.java @@ -16,6 +16,8 @@ public class RepairCons { public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type"; /**数据字典常量-repair_type-*/ public static final String DICT_REPAIR_TYPE = "repair_type"; + /**数据字典常量-insurance_type-*/ + public static final String DICT_INSURANCE_TYPE = "insurance_type"; /**数据字典常量-repair_unit-*/ public static final String DICT_REPAIR_UNIT = "repair_unit"; /**数据字典常量-repair_unit-*/ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/TicketsStatusEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/TicketsStatusEnum.java index 960db751..97a75fb3 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/TicketsStatusEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/TicketsStatusEnum.java @@ -36,9 +36,9 @@ public enum TicketsStatusEnum { */ CHECK_OUT("02","已结账"), /** - * 已交车 + * 已完成 */ - OVER("08","已交车"), + OVER("08","已完成"), /** * 已作废 */ 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 e01b9d76..00729930 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 @@ -7,6 +7,10 @@ import cn.iocoder.yudao.common.RepairCons; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CarMainService; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.vo.*; @@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -39,6 +44,10 @@ public class DlRepairTicketsController { */ @Resource private DlRepairTicketsService dlRepairTicketsService; + @Resource + private CustomerMainService customerMainService; + @Resource + private CarMainService carMainService; /** @@ -86,6 +95,72 @@ public class DlRepairTicketsController { return success(dlRepairTicketsService.getTicketsById(id,ifApp)); } + /** + * 查工单主表信息 + * @author vinjor-M + * @date 14:12 2025/1/8 + * @param id 工单ID + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @GetMapping("/getById") + @Operation(summary = "查工单主表信息") + public CommonResult getById(@RequestParam("id") String id) { + return success(dlRepairTicketsService.getById(id)); + } + + /** + * 维修工单表 更新 + * @author vinjor-M + * @date 14:42 2025/1/8 + * @param repairTickets 工单ID + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @PostMapping("/updateById") + @Operation(summary = "维修工单表 更新") + public CommonResult createTicket(@RequestBody DlRepairTickets repairTickets) { + //更新客户表 + CustomerMain customerMain = new CustomerMain(); + customerMain.setId(repairTickets.getUserId()); + customerMain.setCusName(repairTickets.getUserName()); + customerMain.setPhoneNumber(repairTickets.getUserMobile()); + customerMainService.updateById(customerMain); + //更新车辆表 + CarMain carMain = new CarMain(); + carMain.setId(repairTickets.getCarId()); + //保养日期 + if(null!=repairTickets.getMaintenanceDate()){ + carMain.setMaintenanceDate(repairTickets.getMaintenanceDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + //保养里程 + if(null!=repairTickets.getMaintenanceMileage()) { + carMain.setMaintenanceMileage(repairTickets.getMaintenanceMileage()); + } + //下次年检日期 + if(null!=repairTickets.getNextInspectionDate()) { + carMain.setNextInspectionDate(repairTickets.getNextInspectionDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + //保险到期日期 + if(null!=repairTickets.getInsuranceExpiryDate()) { + carMain.setInsuranceExpiryDate(repairTickets.getInsuranceExpiryDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + //保险公司名称 + if(null!=repairTickets.getInsuranceName()) { + carMain.setInsuranceName(repairTickets.getInsuranceName()); + } + //承保险种,多个英文逗号隔开 + if(null!=repairTickets.getInsuranceType()) { + carMain.setInsuranceType(repairTickets.getInsuranceType()); + } + if(null!=repairTickets.getJiaoqiang()) { + carMain.setJiaoqiang(repairTickets.getJiaoqiang()); + } + if(null!=repairTickets.getShangye()) { + carMain.setShangye(repairTickets.getShangye()); + } + carMainService.updateById(carMain); + return CommonResult.success(dlRepairTicketsService.updateById(repairTickets)); + } + /** * 维修工单表 作废 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java index 90b32486..6c389473 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** @@ -221,6 +222,22 @@ public class DlTicketWaresController { return success(dlTicketWaresService.getByIds(ids)); } + /** + * 确认申领完成配件申请单 + * @author vinjor-M + * @date 11:26 2025/1/3 + * @param id 配件申请单Id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @GetMapping("/confirmOver") + @Operation(summary = "确认申领完成") + public CommonResult confirmOver(@RequestParam("id") String id){ + DlTicketWares ticketWares = dlTicketWaresService.getById(id); + ticketWares.setIsEnd("1"); + dlTicketWaresService.updateById(ticketWares); + return ok(); + } + /** * 导出数据 * 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 c74fee06..b681cc7d 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 @@ -195,6 +195,8 @@ public class DlRepairTickets extends TenantBaseDO { /** 工单完成情况(0:未完成,1:已完成) */ private String isFinish; + /** 是否交车(0未交车|1已交车) */ + private String isHandover; /** 工单当前施工人id */ private Long nowRepairId; @@ -228,4 +230,15 @@ public class DlRepairTickets extends TenantBaseDO { /** 结算备注 */ private String billingRemark; + + /** 年检到期时间 */ + private Date nextInspectionDate; + /** 保险到期时间 */ + private Date insuranceExpiryDate; + /** 承保险种,多个英文逗号隔开 */ + private String insuranceType; + /** 交强险保费 */ + private BigDecimal jiaoqiang; + /** 商业险保费 */ + private BigDecimal shangye; } 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 7a76be51..45c9dbcc 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,8 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 工单配件申请/退回表 * @@ -80,4 +78,6 @@ public class DlTicketWares extends TenantBaseDO { /** 保险公司联系电话 */ private String safeMobile; + /** 是否已完成申领(0未完成|1已完成) */ + private String isEnd; } \ No newline at end of file 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 274079a0..1874a1b0 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 @@ -239,16 +239,40 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class); result.setRepairTypeText(repairTypeMap.getOrDefault(dlRepairTickets.getRepairType(),"")); - //查是否存在总检完成的记录,取出他的时间 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(RepairRecords::getTicketId,id) @@ -390,6 +413,19 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl noPayIdList = new ArrayList<>(); List repairTickets = this.list(); if (!repairTickets.isEmpty()) { + //维修中 workingIdList = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); workingNum = workingIdList.size(); //只要没交车都算在厂 - List inCompanyCodeList = Arrays.asList("04","05","07","01","06","02"); - inCompanyIdList = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); + inCompanyIdList = repairTickets.stream().filter(item -> "0".equals(item.getIsHandover())).map(DlRepairTickets::getId).collect(Collectors.toList()); inCompanyNum = inCompanyIdList.size(); //只要没结算,都是未结算 List noPayCodeList = Arrays.asList("04","05","07","01"); @@ -1655,10 +1700,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl overCodeList = Arrays.asList("07","01","06","02","08"); + overIdList = repairTickets.stream().filter(item -> overCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); overNum = overIdList.size(); - //查累计已交车的(已结算的) - giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),null,null); + //查累计已交车的 + giveCusIdList = repairTickets.stream().filter(item -> "1".equals(item.getIsHandover())).map(DlRepairTickets::getId).collect(Collectors.toList()); giveCusNum = giveCusIdList.size(); }else { //查某个时间范围内进厂数、已完成、已交车 @@ -2018,18 +2064,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() - .set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode()) - .set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode()) - //交车时才能把工单置为完成 - .set(DlRepairTickets::getIsFinish, "1") - .eq(DlRepairTickets::getId, respVO.getId()) - ); - + this.updateById(repairTickets); // 记录日志 repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage()); - refreshUpdateTime(respVO.getId()); } 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 c6bb5534..2e3145e5 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -54,6 +54,11 @@ + + + + + @@ -106,6 +111,11 @@ + + + + + @@ -164,7 +174,12 @@ confirm_fault_money, billing_remark, handle_name, - handle_mobile + handle_mobile, + nextInspection_date, + insuranceExpiry_date, + insurance_type, + jiaoqiang, + shangye from dl_repair_tickets drt where drt.deleted = '0' @@ -411,6 +426,10 @@ -- 服务顾问查所有的就是服务顾问是自己的 -- and drt.adviser_id = #{map.adviserId} + + -- 是否交车 -- + and drt.is_handover = #{map.isHandover} + -- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 -- and ( 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 25bdb30d..c0efaf3d 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml @@ -54,7 +54,7 @@ from dl_ticket_wares dtw left join dl_repair_tickets drt on dtw.ticket_id = drt.id - where dtw.deleted = '0' + where dtw.deleted = '0' AND dtw.is_end='0'