diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java index 9a5c946c..cfaff6de 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java @@ -80,7 +80,7 @@ public enum RecordTypeEnum { /** 删除工单 */ SCGG("scgg", "删除工单"), - /** 删除工单 */ + /** 交车 */ JC("jc", "交车"), /** 内返派工 */ 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 ce29b4bb..960db751 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 @@ -19,18 +19,14 @@ public enum TicketsStatusEnum { * 施工中 */ WORKING("05","施工中"), - /** - * 未结账 - */ - NO_PAY("01","未结账"), /** * 待通知客户取车 */ WAITING_NOTICE("07","待通知客户取车"), /** - * 已交车 + * 未结账 */ - OVER("08","已交车"), + NO_PAY("01","未结账"), /** * 挂单/记账 */ @@ -39,6 +35,10 @@ public enum TicketsStatusEnum { * 已结账 */ CHECK_OUT("02","已结账"), + /** + * 已交车 + */ + OVER("08","已交车"), /** * 已作废 */ 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 0ca90e77..931ea202 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 @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 针对表【dl_repair_tickets(维修工单表)】的数据库操作Mapper * @@ -52,6 +54,8 @@ public interface DlRepairTicketsMapper extends BaseMapper { * @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); } 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 a0170e3d..0dbf8180 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 @@ -1024,7 +1024,57 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl idList = new ArrayList<>(); + if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){ + //已竣工 + idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.ZJ.getCode(),startDate,endDate); + }else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){ + //已交车 + idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.JC.getCode(),startDate,endDate); + }else { + //进厂 + repairTicketsReqVO.setStartDate(startDate); + repairTicketsReqVO.setEndDate(endDate); + } + if(null!=idList && !idList.isEmpty()){ + repairTicketsReqVO.setIdList(idList); + //时间查询条件置空 + repairTicketsReqVO.setStartDate(null); + repairTicketsReqVO.setEndDate(null); + } + }else { + //否则查询时间不生效,按维修状态查 + List statusList = new ArrayList<>(); + if("weixiuzhong".equals(repairTicketsReqVO.getTicketsStatus())){ + //维修中 + statusList.add(TicketsStatusEnum.WORKING.getCode()); + }else if("weijiesuan".equals(repairTicketsReqVO.getTicketsStatus())){ + //未结算 + statusList = Arrays.asList("04","05","07","01"); + }else if("zaichang".equals(repairTicketsReqVO.getTicketsStatus())){ + //在厂 + statusList = Arrays.asList("04","05","07","01","06","02"); + }else if("jinchang".equals(repairTicketsReqVO.getTicketsStatus())){ + //进厂 + statusList.add(TicketsStatusEnum.NO_WORK.getCode()); + }else if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){ + //已竣工 + statusList.add(TicketsStatusEnum.WAITING_NOTICE.getCode()); + }else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){ + //已交车 + statusList.add(TicketsStatusEnum.OVER.getCode()); + } + if(!statusList.isEmpty()){ + repairTicketsReqVO.setStatusList(statusList); + } + } return baseMapper.getPageTypeAll(repairTicketsReqVO, page); } } @@ -1562,10 +1612,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl repairTickets = this.list(); if (!repairTickets.isEmpty()) { workingNum = repairTickets.stream().filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus())).count(); - inCompanyNum = repairTickets.stream().filter(item -> TicketsStatusEnum.NO_PAY.getCode().equals(item.getTicketsStatus())).count(); + //只要没交车都算在厂 + List inCompanyCodeList = Arrays.asList("04","05","07","01","06","02"); + inCompanyNum = repairTickets.stream().filter(item -> inCompanyCodeList.contains(item.getTicketsStatus())).count(); + //只要没结算,都是未结算 + List noPayCodeList = Arrays.asList("04","05","07","01"); + noPayNum = repairTickets.stream().filter(item -> noPayCodeList.contains(item.getTicketsStatus())).count(); LocalDateTime currentTime = LocalDateTime.now(); if("today".equals(selectType)){ String nowDayStr = DateUtil.formatDate(new Date()); @@ -1573,15 +1630,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl item.getCreateTime().toLocalDate().equals(currentTime.toLocalDate())).count(); //查当日已完成的(总检完成的) overNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.ZJ.getCode(),null,null); - //查当日已交车的(已结算的) - giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JS.getCode(),null,null); + //查当日已交车的 + giveCusNum = repairTicketsMapper.selectCountByParams(nowDayStr,RecordTypeEnum.JC.getCode(),null,null); }else if("all".equals(selectType)){ //查累计进厂数、已完成、已交车 newOrderNum = repairTickets.size(); //查累计已完成的(总检完成的) overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(),null,null); //查累计已交车的(已结算的) - giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(),null,null); + giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(),null,null); }else { //查某个时间范围内进厂数、已完成、已交车 LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); @@ -1589,8 +1646,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl item.getCreateTime().isAfter(startTime) && item.getCreateTime().isBefore(endTime)).count(); //查某区间范围内已完成的(总检完成的) overNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.ZJ.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); - //查某区间范围内已交车的(已结算的) - giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JS.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); + //查某区间范围内已交车的 + giveCusNum = repairTicketsMapper.selectCountByParams(null,RecordTypeEnum.JC.getCode(), startDate+" 00:00:00", endDate+" 23:59:59"); } } rtnMap.put("workingNum", workingNum); @@ -1598,6 +1655,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl statusList; + /** 工单id集和 */ + private List idList; } 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 02fcf279..19483ced 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -369,11 +369,28 @@ ) - and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]} + and (drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}) + + + and (drt.create_time >= #{map.startDate} and drt.create_time <= #{map.endDate}) AND (drt.repair_type=#{map.repairType}) + + AND (drt.tickets_status IN + + #{item} + + ) + + + AND (drt.id IN + + #{item} + + ) + @@ -424,4 +441,20 @@ AND drr.create_time <= #{endTime} +