diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/booking/vo/BookingQueryVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/booking/vo/BookingQueryVO.java index 27652164..3ce0b49b 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/booking/vo/BookingQueryVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/booking/vo/BookingQueryVO.java @@ -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.company.entity.Company; 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; /** @@ -20,4 +20,8 @@ public class BookingQueryVO extends DlRepairBooking { /** 服务信息 */ private ServicePackageDto servicePackage; + /** 服务顾问信息 */ + private AdminUserRespDTO adviser; + /** 预约的维修项目名称 */ + private String repairTypeText; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/controller/TicketsAPI.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/controller/TicketsAPI.java index f0c04d3b..7c925361 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/controller/TicketsAPI.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/controller/TicketsAPI.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.app.tickets.controller; 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 io.swagger.v3.oas.annotations.Operation; import org.springframework.web.bind.annotation.GetMapping; @@ -36,6 +37,7 @@ public class TicketsAPI { **/ @GetMapping("/get") @Operation(summary = "维修工单表 查看一个工单的详细信息") + @TenantIgnore public CommonResult getTicketsById(@RequestParam(value = "id") String id){ return success(dlRepairTicketsService.getTicketsById(id)); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/entity/DlRepairBooking.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/entity/DlRepairBooking.java index 0f00d431..2ec624db 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/entity/DlRepairBooking.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/entity/DlRepairBooking.java @@ -45,6 +45,10 @@ public class DlRepairBooking extends TenantBaseDO { * 项目ID(查PC服务分类的一级项目的ID) */ private String projectId; + /** + * 预约服务项目(字典repair_type) + */ + private String repairType; /** * 车辆信息(base_car_main的id) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java index af024ebf..8a265cca 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/service/impl/DlRepairBookingServiceImpl.java @@ -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.company.entity.Company; 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.service.ServicePackageApi; 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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; +import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE; + /** * 针对表【dl_repair_booking(维修预约表)】的数据库操作Service实现 * @@ -44,12 +52,16 @@ public class DlRepairBookingServiceImpl extends ServiceImpl(); } List dlRepairBookings = baseMapper.selectBatchIds(ids); + //所有服务顾问ID + List adviserIdList = new ArrayList<>(); + Map userMap = new HashMap<>(); + dlRepairBookings.forEach(item->{ + if(StringUtils.isNotEmpty(item.getAdviserId())){ + adviserIdList.add(Long.valueOf(item.getAdviserId())); + } + }); + if(!adviserIdList.isEmpty()){ + List userDOList = adminUserApi.getUserList(adviserIdList); + userMap = userDOList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity())); + } List result = dlRepairBookings.stream().map(item -> BeanUtil.toBean(item, BookingQueryVO.class)).collect(Collectors.toList()); // 查企业 Set companyIds = result.stream().map(BookingQueryVO::getCorpId).collect(Collectors.toSet()); @@ -125,10 +149,20 @@ public class DlRepairBookingServiceImpl extends ServiceImpl serviceIds = result.stream().map(BookingQueryVO::getProjectId).collect(Collectors.toSet()); List servicePackageByIds = servicePackageApi.getServicePackageByIds(new ArrayList<>(serviceIds)); + //维修项目类型字典 + List repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE); + Map repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); // 映射 + Map finalUserMap = userMap; result.forEach(item -> { 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); + 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()); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/app/ApiRepairTitemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/app/ApiRepairTitemController.java new file mode 100644 index 00000000..7452f3bd --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/app/ApiRepairTitemController.java @@ -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)); + } +} +