This commit is contained in:
Vinjor 2024-12-12 14:11:01 +08:00
parent dc6ec5a8dc
commit b1ddfa6c05
4 changed files with 53 additions and 39 deletions

View File

@ -45,6 +45,7 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
**/ **/
IPage<DlRepairTickets> getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page); IPage<DlRepairTickets> getPageTypeAll(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
/** /**
* 根据条件查询指定工单数量 * 根据条件查询指定工单数量
* @author vinjor-M * @author vinjor-M
@ -53,9 +54,7 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
* @param recordCode 操作记录code * @param recordCode 操作记录code
* @return java.lang.Long * @return java.lang.Long
**/ **/
Long selectCountByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime); List<String> selectTicketIdByParams(@Param("nowDate")String dayDate, @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
List<String> selectTicketIdByParams( @Param("recordCode")String recordCode, @Param("startTime")String startTime, @Param("endTime")String endTime);
} }

View File

@ -173,7 +173,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @date 11:30 2024/10/24 * @date 11:30 2024/10/24
* @return java.util.Map<java.lang.String,java.lang.Integer> * @return java.util.Map<java.lang.String,java.lang.Integer>
**/ **/
Map<String,Long> getBossNum(String selectType,String startDate,String endDate); Map<String,Object> getBossNum(String selectType,String startDate,String endDate);
/** /**
* 服务顾问通知客户取车 * 服务顾问通知客户取车

View File

@ -978,6 +978,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Override @Override
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) { public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
String userRoleCode = getUserRole(); 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())) { if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
//维修管理员看所有数据 //维修管理员看所有数据
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) { } else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
@ -1034,10 +1040,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
if("yijungong".equals(repairTicketsReqVO.getTicketsStatus())){ 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())){ }else if("yijiaoche".equals(repairTicketsReqVO.getTicketsStatus())){
//已交车 //已交车
idList = repairTicketsMapper.selectTicketIdByParams(RecordTypeEnum.JC.getCode(),startDate,endDate); idList = repairTicketsMapper.selectTicketIdByParams(null,RecordTypeEnum.JC.getCode(),startDate,endDate);
}else { }else {
//进厂 //进厂
repairTicketsReqVO.setStartDate(startDate); repairTicketsReqVO.setStartDate(startDate);
@ -1600,62 +1606,86 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
* @date 11:30 2024/10/24 * @date 11:30 2024/10/24
**/ **/
@Override @Override
public Map<String, Long> getBossNum(String selectType,String startDate,String endDate) { public Map<String, Object> getBossNum(String selectType,String startDate,String endDate) {
Map<String, Long> rtnMap = new HashMap<>(); Map<String, Object> rtnMap = new HashMap<>();
//维修中---当前这一时刻 //维修中---当前这一时刻
long workingNum = 0; long workingNum = 0;
List<String> workingIdList = new ArrayList<>();
//在厂数--当前这一时刻 //在厂数--当前这一时刻
long inCompanyNum = 0; long inCompanyNum = 0;
List<String> inCompanyIdList = new ArrayList<>();
//进场数 //进场数
long newOrderNum=0; long newOrderNum=0;
List<String> newOrderIdList = new ArrayList<>();
//已完成 //已完成
long overNum=0; long overNum=0;
List<String> overIdList = new ArrayList<>();
//已交车 //已交车
long giveCusNum=0; long giveCusNum=0;
List<String> giveCusIdList = new ArrayList<>();
//未结算 //未结算
long noPayNum=0; long noPayNum=0;
List<String> noPayIdList = new ArrayList<>();
List<DlRepairTickets> repairTickets = this.list(); List<DlRepairTickets> repairTickets = this.list();
if (!repairTickets.isEmpty()) { 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<String> inCompanyCodeList = Arrays.asList("04","05","07","01","06","02"); List<String> 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<String> noPayCodeList = Arrays.asList("04","05","07","01"); List<String> 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(); LocalDateTime currentTime = LocalDateTime.now();
if("today".equals(selectType)){ if("today".equals(selectType)){
String nowDayStr = DateUtil.formatDate(new Date()); 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)){ }else if("all".equals(selectType)){
//查累计进厂数已完成已交车 //查累计进厂数已完成已交车
newOrderIdList = repairTickets.stream().map(DlRepairTickets::getId).collect(Collectors.toList());
newOrderNum = repairTickets.size(); 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 { }else {
//查某个时间范围内进厂数已完成已交车 //查某个时间范围内进厂数已完成已交车
LocalDateTime startTime = LocalDateTime.parse(startDate+" 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); 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")); 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("workingNum", workingNum);
rtnMap.put("workingIdList", workingIdList);
rtnMap.put("inCompanyNum", inCompanyNum); rtnMap.put("inCompanyNum", inCompanyNum);
rtnMap.put("inCompanyIdList", inCompanyIdList);
rtnMap.put("newOrderNum", newOrderNum); rtnMap.put("newOrderNum", newOrderNum);
rtnMap.put("newOrderIdList", newOrderIdList);
rtnMap.put("overNum", overNum); rtnMap.put("overNum", overNum);
rtnMap.put("overIdList", overIdList);
rtnMap.put("giveCusNum", giveCusNum); rtnMap.put("giveCusNum", giveCusNum);
rtnMap.put("giveCusIdList", giveCusIdList);
rtnMap.put("noPayNum", noPayNum); rtnMap.put("noPayNum", noPayNum);
rtnMap.put("noPayIdList", noPayIdList);
return rtnMap; return rtnMap;
} }

View File

@ -422,9 +422,10 @@
GROUP BY drt.id GROUP BY drt.id
order by drt.update_time desc order by drt.update_time desc
</select> </select>
<select id="selectCountByParams" resultType="java.lang.Long">
<select id="selectTicketIdByParams" resultType="java.lang.String">
SELECT SELECT
COUNT(DISTINCT drt.id) DISTINCT drt.id
FROM FROM
dl_repair_tickets drt dl_repair_tickets drt
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id
@ -441,20 +442,4 @@
AND drr.create_time &lt;= #{endTime} AND drr.create_time &lt;= #{endTime}
</if> </if>
</select> </select>
<select id="selectTicketIdByParams" resultType="java.lang.String">
SELECT
DISTINCT drt.id
FROM
dl_repair_tickets drt
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id
AND drr.deleted = '0'
WHERE
drt.deleted = '0'
AND drt.tickets_status !='03'
AND drr.type = #{recordCode}
<if test="startTime!=null">
AND drr.create_time &gt;= #{startTime}
AND drr.create_time &lt;= #{endTime}
</if>
</select>
</mapper> </mapper>