From 4e50de5bfe8e4b63a650035549bc3cac0dcdc6f5 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Sat, 12 Oct 2024 19:59:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=B7=A5=E6=8E=A5=E5=8D=95/?= =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=8F=AD=E7=BB=84=E9=95=BF=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=8C=87=E6=B4=BE=EF=BC=8C=E7=BB=B4=E4=BF=AE=E5=B7=A5=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E9=85=8D=E4=BB=B6=E7=94=B3=E8=AF=B7=E5=8D=95=201/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/common/RepairConstants.java | 19 +++++ .../admin/DlRepairTicketsController.java | 18 ++++ .../tickets/entity/DlRepairTickets.java | 3 + .../tickets/mapper/DlRepairTicketsMapper.java | 9 ++ .../service/DlRepairTicketsService.java | 9 ++ .../impl/DlRepairTicketsServiceImpl.java | 64 ++++++++++++++- .../tickets/vo/DlRepairTicketsReqVO.java | 4 + .../mapper/tickets/DlRepairTicketsMapper.xml | 82 ++++++++++++++++++- 8 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java new file mode 100644 index 00000000..e14f8296 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.common; + +/** + * 维修系统中的通用常量类 + * + * @author 小李 + * @date 16:51 2024/10/12 +**/ +public class RepairConstants { + + public static final String SERVICE_ADVISOR = "维修服务顾问"; + + public static final String GENERAL_INSPECTION = "维修总检"; + + public static final String TEAM_LEADER = "班组长"; + + public static final String REPAIR_STAFF = "维修工"; + +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java index cf88bd70..b2b0da1a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java @@ -115,5 +115,23 @@ public class DlRepairTicketsController { dlRepairTicketsService.updateCustomerAndCar(customerAndCarVO); return CommonResult.ok(); } + + /** + * 分类查询工单分页 + * + * @author 小李 + * @date 16:26 2024/10/12 + * @param repairTicketsReqVO 查询对象 + * @param pageNo 页码 + * @param pageSize 条数 + **/ + @GetMapping("/pageType") + @Operation(summary = "分类查询工单分页") + public CommonResult getPageType(DlRepairTicketsReqVO repairTicketsReqVO, + @RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){ + Page page = new Page<>(pageNo, pageSize); + return success(dlRepairTicketsService.getPageType(repairTicketsReqVO, page)); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java index eca56066..a9901ea0 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java @@ -175,4 +175,7 @@ public class DlRepairTickets extends TenantBaseDO { /** 工单进行状态 */ private String ticketsWorkStatus; + + /** 工单完成情况(0:未完成,1:已完成) */ + private String isFinish; } 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 fd13a7a6..23dec322 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 @@ -25,6 +25,15 @@ public interface DlRepairTicketsMapper extends BaseMapper { * @param repairTicketsReqVO 查询对象 **/ IPage getTicketsPage(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page page); + + /** + * 分类查询工单分页 + * + * @author 小李 + * @date 16:26 2024/10/12 + * @param repairTicketsReqVO 查询对象 + **/ + IPage getPageType(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page page); } 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 e1fd55fd..b56aa449 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 @@ -69,4 +69,13 @@ public interface DlRepairTicketsService extends IService { * @param customerAndCarVO 用户信息和车辆信息 **/ void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO); + + /** + * 分类查询工单分页 + * + * @author 小李 + * @date 16:26 2024/10/12 + * @param repairTicketsReqVO 查询对象 + **/ + IPage getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page page); } 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 5bdc8694..ea157737 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 @@ -3,8 +3,11 @@ package cn.iocoder.yudao.module.tickets.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.common.RepairConstants; import cn.iocoder.yudao.common.RepairErrorCodeConstants; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.base.entity.RepairWorker; +import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; import cn.iocoder.yudao.module.custom.entity.CustomerCar; @@ -24,6 +27,9 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; 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.PermissionApi; +import cn.iocoder.yudao.module.system.api.permission.RoleApi; +import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; 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; @@ -42,12 +48,15 @@ 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.springframework.context.annotation.Lazy; +import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.print.Doc; import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -109,6 +118,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page page){ + // 查看当前登录用户是什么角色 + // 当前登录用户的角色信息 + List byUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId()); + // 所有的角色信息 + List roleList = roleApi.getRoleList(); + // 过滤出登录用户有的角色信息 + List collect = roleList.stream().filter(item -> byUserId.contains(item.getId())).collect(Collectors.toList()); + // 取出角色名称 + List names = collect.stream().map(RoleReqDTO::getName).collect(Collectors.toList()); + if (names.contains(RepairConstants.SERVICE_ADVISOR)){ + // 服务顾问的ID + repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId())); + }else if (names.contains(RepairConstants.TEAM_LEADER)){ + // 班组长 + // 查自己是什么班组的组长 + RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId())); + // 查自己班组的员工信息 + List list = repairWorkerService.list(new LambdaQueryWrapper().eq(RepairWorker::getWorkType, one.getWorkType())); + // 所有的员工信息 + List userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList()); + // 可能指定的时候指定的有班组长,所以还要加班组长的id也加进去 + userIds.add(one.getUserId()); + repairTicketsReqVO.setUserIds(userIds); + }else if (names.contains(RepairConstants.REPAIR_STAFF)){ + // 维修工的ID + repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId())); + }else if (names.contains(RepairConstants.GENERAL_INSPECTION)){ + // 维修总检,不操作 + }else return null; + return baseMapper.getPageType(repairTicketsReqVO, page); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java index 4ca8a912..a138d05e 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java @@ -6,6 +6,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -21,4 +22,7 @@ public class DlRepairTicketsReqVO extends DlRepairTickets { @Schema(pattern = "时间区间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private Date[] searchTimeArray; + + /** 工单中项目指定的施工人员的ids */ + private List userIds; } 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 24e838f9..e26cc488 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -42,6 +42,7 @@ + @@ -81,7 +82,8 @@ cost, profit, part_status, - tickets_work_status + tickets_work_status, + is_finish from dl_repair_tickets drt where drt.deleted = '0' @@ -124,4 +126,82 @@ order by drt.create_time desc + + + + + +