1
This commit is contained in:
parent
e02e370fbb
commit
1112dfd883
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.app.booking.vo;
|
|||||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||||
import cn.iocoder.yudao.module.company.entity.Company;
|
import cn.iocoder.yudao.module.company.entity.Company;
|
||||||
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,4 +20,8 @@ public class BookingQueryVO extends DlRepairBooking {
|
|||||||
|
|
||||||
/** 服务信息 */
|
/** 服务信息 */
|
||||||
private ServicePackageDto servicePackage;
|
private ServicePackageDto servicePackage;
|
||||||
|
/** 服务顾问信息 */
|
||||||
|
private AdminUserRespDTO adviser;
|
||||||
|
/** 预约的维修项目名称 */
|
||||||
|
private String repairTypeText;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.app.tickets.controller;
|
package cn.iocoder.yudao.module.app.tickets.controller;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -36,6 +37,7 @@ public class TicketsAPI {
|
|||||||
**/
|
**/
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "维修工单表 查看一个工单的详细信息")
|
@Operation(summary = "维修工单表 查看一个工单的详细信息")
|
||||||
|
@TenantIgnore
|
||||||
public CommonResult<?> getTicketsById(@RequestParam(value = "id") String id){
|
public CommonResult<?> getTicketsById(@RequestParam(value = "id") String id){
|
||||||
return success(dlRepairTicketsService.getTicketsById(id));
|
return success(dlRepairTicketsService.getTicketsById(id));
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ public class DlRepairBooking extends TenantBaseDO {
|
|||||||
* 项目ID(查PC服务分类的一级项目的ID)
|
* 项目ID(查PC服务分类的一级项目的ID)
|
||||||
*/
|
*/
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
/**
|
||||||
|
* 预约服务项目(字典repair_type)
|
||||||
|
*/
|
||||||
|
private String repairType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息(base_car_main的id)
|
* 车辆信息(base_car_main的id)
|
||||||
|
@ -15,22 +15,30 @@ import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
|
|||||||
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
|
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
|
||||||
import cn.iocoder.yudao.module.company.entity.Company;
|
import cn.iocoder.yudao.module.company.entity.Company;
|
||||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||||
import cn.iocoder.yudao.module.system.api.service.ServicePackageApi;
|
import cn.iocoder.yudao.module.system.api.service.ServicePackageApi;
|
||||||
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对表【dl_repair_booking(维修预约表)】的数据库操作Service实现
|
* 针对表【dl_repair_booking(维修预约表)】的数据库操作Service实现
|
||||||
*
|
*
|
||||||
@ -44,12 +52,16 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
|||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
@Resource
|
||||||
|
private DictDataApi dictDataApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
private ServicePackageApi servicePackageApi;
|
private ServicePackageApi servicePackageApi;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RoleApi roleApi;
|
private RoleApi roleApi;
|
||||||
|
@Autowired
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修预约表 新增、修改
|
* 维修预约表 新增、修改
|
||||||
@ -118,6 +130,18 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<DlRepairBooking> dlRepairBookings = baseMapper.selectBatchIds(ids);
|
List<DlRepairBooking> dlRepairBookings = baseMapper.selectBatchIds(ids);
|
||||||
|
//所有服务顾问ID
|
||||||
|
List<Long> adviserIdList = new ArrayList<>();
|
||||||
|
Map<Long,AdminUserRespDTO> userMap = new HashMap<>();
|
||||||
|
dlRepairBookings.forEach(item->{
|
||||||
|
if(StringUtils.isNotEmpty(item.getAdviserId())){
|
||||||
|
adviserIdList.add(Long.valueOf(item.getAdviserId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(!adviserIdList.isEmpty()){
|
||||||
|
List<AdminUserRespDTO> userDOList = adminUserApi.getUserList(adviserIdList);
|
||||||
|
userMap = userDOList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
|
||||||
|
}
|
||||||
List<BookingQueryVO> result = dlRepairBookings.stream().map(item -> BeanUtil.toBean(item, BookingQueryVO.class)).collect(Collectors.toList());
|
List<BookingQueryVO> result = dlRepairBookings.stream().map(item -> BeanUtil.toBean(item, BookingQueryVO.class)).collect(Collectors.toList());
|
||||||
// 查企业
|
// 查企业
|
||||||
Set<String> companyIds = result.stream().map(BookingQueryVO::getCorpId).collect(Collectors.toSet());
|
Set<String> companyIds = result.stream().map(BookingQueryVO::getCorpId).collect(Collectors.toSet());
|
||||||
@ -125,10 +149,20 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
|||||||
// 查服务
|
// 查服务
|
||||||
Set<String> serviceIds = result.stream().map(BookingQueryVO::getProjectId).collect(Collectors.toSet());
|
Set<String> serviceIds = result.stream().map(BookingQueryVO::getProjectId).collect(Collectors.toSet());
|
||||||
List<ServicePackageDto> servicePackageByIds = servicePackageApi.getServicePackageByIds(new ArrayList<>(serviceIds));
|
List<ServicePackageDto> servicePackageByIds = servicePackageApi.getServicePackageByIds(new ArrayList<>(serviceIds));
|
||||||
|
//维修项目类型字典
|
||||||
|
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
|
||||||
|
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
|
||||||
// 映射
|
// 映射
|
||||||
|
Map<Long, AdminUserRespDTO> finalUserMap = userMap;
|
||||||
result.forEach(item -> {
|
result.forEach(item -> {
|
||||||
companies.stream().filter(i -> i.getId().equals(item.getCorpId())).findFirst().ifPresent(item::setCompany);
|
companies.stream().filter(i -> i.getId().equals(item.getCorpId())).findFirst().ifPresent(item::setCompany);
|
||||||
servicePackageByIds.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setServicePackage);
|
servicePackageByIds.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setServicePackage);
|
||||||
|
if(StringUtils.isNotEmpty(item.getAdviserId())){
|
||||||
|
item.setAdviser(finalUserMap.get(Long.valueOf(item.getAdviserId())));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(item.getRepairType())){
|
||||||
|
item.setRepairTypeText(repairTypeMap.get(item.getRepairType()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return result.stream().sorted(Comparator.comparing(BookingQueryVO::getCreateTime).reversed()).collect(Collectors.toList());
|
return result.stream().sorted(Comparator.comparing(BookingQueryVO::getCreateTime).reversed()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.tickets.controller.app;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修工单子表(DlRepairTitem)表控制层
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 11:48 2024/11/5
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/repair/titem")
|
||||||
|
public class ApiRepairTitemController {
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private DlRepairTitemService dlRepairTitemService;
|
||||||
|
/**
|
||||||
|
* 查某工单维修项目进度
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 10:57 2024/11/5
|
||||||
|
* @param ticketId 工单id
|
||||||
|
**/
|
||||||
|
@GetMapping("/getProjList")
|
||||||
|
@Operation(summary = "查某工单维修项目进度")
|
||||||
|
@TenantIgnore
|
||||||
|
public CommonResult<?> getProjList(@RequestParam("ticketId") String ticketId){
|
||||||
|
return success(dlRepairTitemService.getProjList(ticketId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user