From b1ddfa6c05c9f49d9632715a8b5799ae49ef1385 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Thu, 12 Dec 2024 14:11:01 +0800 Subject: [PATCH] 1 --- .../tickets/mapper/DlRepairTicketsMapper.java | 9 ++- .../service/DlRepairTicketsService.java | 2 +- .../impl/DlRepairTicketsServiceImpl.java | 60 ++++++++++++++----- .../mapper/tickets/DlRepairTicketsMapper.xml | 21 +------ 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/mapper/DlRepairTicketsMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/mapper/DlRepairTicketsMapper.java index 931ea202..ba318aed 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/mapper/DlRepairTicketsMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/mapper/DlRepairTicketsMapper.java @@ -45,17 +45,16 @@ public interface DlRepairTicketsMapper extends BaseMapper { **/ IPage getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page page); + /** * 根据条件查询指定工单数量 * @author vinjor-M * @date 15:46 2024/11/18 * @param dayDate 某一天日期 - * @param recordCode 操作记录code + * @param recordCode 操作记录code * @return java.lang.Long - **/ - Long selectCountByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime); - - List selectTicketIdByParams( @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime); + **/ + List selectTicketIdByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime); } 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 e4d2115f..b7de9700 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 @@ -173,7 +173,7 @@ public interface DlRepairTicketsService extends IService { * @date 11:30 2024/10/24 * @return java.util.Map **/ - Map getBossNum(String selectType,String startDate,String endDate); + Map getBossNum(String selectType,String startDate,String endDate); /** * 服务顾问通知客户取车 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 0dbf8180..274079a0 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 @@ -978,6 +978,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page page) { String userRoleCode = getUserRole(); + if(null!=repairTicketsReqVO.getIdList() && repairTicketsReqVO.getIdList().size()>0){ + //根据id集和查询 + DlRepairTicketsReqVO queryObj = new DlRepairTicketsReqVO(); + queryObj.setIdList(repairTicketsReqVO.getIdList()); + return baseMapper.getPageTypeAll(queryObj, page); + } if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) { //维修管理员看所有数据 } else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) { @@ -1034,10 +1040,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl idList = new ArrayList<>(); if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){ //已竣工 - idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.ZJ.getCode(),startDate,endDate); + idList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(),startDate,endDate); }else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){ //已交车 - idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.JC.getCode(),startDate,endDate); + idList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),startDate,endDate); }else { //进厂 repairTicketsReqVO.setStartDate(startDate); @@ -1600,62 +1606,86 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl getBossNum(String selectType,String startDate,String endDate) { - Map rtnMap = new HashMap<>(); + public Map getBossNum(String selectType,String startDate,String endDate) { + Map rtnMap = new HashMap<>(); //维修中---当前这一时刻 long workingNum = 0; + List workingIdList = new ArrayList<>(); //在厂数--当前这一时刻 long inCompanyNum = 0; + List inCompanyIdList = new ArrayList<>(); //进场数 long newOrderNum=0; + List newOrderIdList = new ArrayList<>(); //已完成 long overNum=0; + List overIdList = new ArrayList<>(); //已交车 long giveCusNum=0; + List giveCusIdList = new ArrayList<>(); //未结算 long noPayNum=0; + List noPayIdList = new ArrayList<>(); List repairTickets = this.list(); if (!repairTickets.isEmpty()) { - workingNum = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).count(); + 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"); - inCompanyNum = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).count(); + inCompanyIdList = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); + inCompanyNum = inCompanyIdList.size(); //只要没结算,都是未结算 List noPayCodeList = Arrays.asList("04","05","07","01"); - noPayNum = repairTickets.stream().filter(item -> noPayCodeList.contains(item.getTicketsStatus())).count(); + noPayIdList = repairTickets.stream().filter(item -> noPayCodeList.contains(item.getTicketsStatus())).map(DlRepairTickets::getId).collect(Collectors.toList()); + noPayNum = noPayIdList.size(); LocalDateTime currentTime = LocalDateTime.now(); if("today".equals(selectType)){ String nowDayStr = DateUtil.formatDate(new Date()); //查当日进厂数、已完成、已交车 - newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).count(); + newOrderIdList = repairTickets.stream().filter(item -> item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).map(DlRepairTickets::getId).collect(Collectors.toList()); + newOrderNum = newOrderIdList.size(); //查当日已完成的(总检完成的) - overNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null); + overIdList = repairTicketsMapper.selectTicketIdByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null); + overNum = overIdList.size(); //查当日已交车的 - giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JC.getCode(),null,null); + giveCusIdList = repairTicketsMapper.selectTicketIdByParams(nowDayStr,RecordTypeEnum.JC.getCode(),null,null); + giveCusNum = giveCusIdList.size(); }else if("all".equals(selectType)){ //查累计进厂数、已完成、已交车 + newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList()); newOrderNum = repairTickets.size(); //查累计已完成的(总检完成的) - overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(),null,null); + overIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(),null,null); + overNum = overIdList.size(); //查累计已交车的(已结算的) - giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(),null,null); + giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),null,null); + giveCusNum = giveCusIdList.size(); }else { //查某个时间范围内进厂数、已完成、已交车 LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); LocalDateTime endTime = LocalDateTime.parse(endDate+" 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - newOrderNum = repairTickets.stream().filter(item -> item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).count(); + newOrderIdList = repairTickets.stream().filter(item -> item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).map(DlRepairTickets::getId).collect(Collectors.toList()); + newOrderNum = newOrderIdList.size(); //查某区间范围内已完成的(总检完成的) - overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); + overIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); + overNum = overIdList.size(); //查某区间范围内已交车的 - giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); + giveCusIdList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); + giveCusNum = giveCusIdList.size(); } } rtnMap.put("workingNum", workingNum); + rtnMap.put("workingIdList", workingIdList); rtnMap.put("inCompanyNum", inCompanyNum); + rtnMap.put("inCompanyIdList", inCompanyIdList); rtnMap.put("newOrderNum", newOrderNum); + rtnMap.put("newOrderIdList", newOrderIdList); rtnMap.put("overNum", overNum); + rtnMap.put("overIdList", overIdList); rtnMap.put("giveCusNum", giveCusNum); + rtnMap.put("giveCusIdList", giveCusIdList); rtnMap.put("noPayNum", noPayNum); + rtnMap.put("noPayIdList", noPayIdList); return rtnMap; } 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 19483ced..c6bb5534 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -422,9 +422,10 @@ GROUP BY drt.id order by drt.update_time desc - SELECT - COUNT(DISTINCT drt.id) + DISTINCT drt.id FROM dl_repair_tickets drt LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id @@ -441,20 +442,4 @@ AND drr.create_time <= #{endTime} -