From 3e431533f1bb895f4bbfeaa3f34ed80b6aab438c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Tue, 12 Nov 2024 16:39:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=A2=9E=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=97=B6=E9=80=89=E6=8B=A9=E5=BC=95=E8=BD=A6=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/DlInspectionProject.java | 5 +++++ .../inspection/entity/InspectionInfo.java | 4 ++++ .../impl/InspectionInfoServiceImpl.java | 15 ++++++++++--- .../impl/InspectionWorkNodeServiceImpl.java | 22 ++++++++++++++----- .../inspection/InspectionInfoMapper.xml | 5 +++-- .../admin/permission/RoleController.java | 13 +++++++++++ 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java index e96e64fb..59ad0047 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/DlInspectionProject.java @@ -41,6 +41,11 @@ public class DlInspectionProject extends TenantBaseDO { */ private String remark; + /** + * 排序 + */ + private Integer sort; + @TableField(exist = false) private List projectRoyaltyList; } \ No newline at end of file diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java index cce9aa5d..5a5f52fd 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java @@ -92,6 +92,8 @@ public class InspectionInfo extends TenantBaseDO private String day; //客户来源 private String customerSource; + /** 引车员id*/ + private Long leadManId; @TableField(exist = false) private String lastTitle; @@ -157,4 +159,6 @@ public class InspectionInfo extends TenantBaseDO private Long dealUserId; @TableField(exist = false) private String workNodeStatus; + @TableField(exist = false) + private String selectType; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index 461a7ba5..b8f5ce34 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -25,8 +25,10 @@ import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService; import cn.iocoder.yudao.module.payment.service.OrderInfoService; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.SendSmsUtil; @@ -91,6 +93,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(roleId); - if (CollUtil.isNotEmpty(listByUserId)) { - for (UserDTO userDTO : listByUserId) { - inspectionSocket.sendMessage("接工单", userDTO.getId().toString()); + List ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList()); + ids.add(inspectionInfo.getLeadManId()); + // 获取当前共单引车员的id + if (CollUtil.isNotEmpty(ids)) { + for (Long id : ids) { + inspectionSocket.sendMessage("接工单", id.toString()); } + } //检测步骤表插入检测开始 @@ -390,6 +398,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl byUserId = roleService.getByUserId(loginUser.getId()); + inspectionInfo.setLeadManId(loginUser.getId()); List roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); if (!"1".equals(inspectionInfo.getStatus())) { //进行中 已完成 diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java index e4152001..892ca88c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java @@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** *

@@ -194,8 +195,13 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(nextNode.getRoleId()); - sendSocketMessage(listByUserId); + List ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList()); + if (ObjectUtil.isNotNull(inspectionInfo.getLeadManId())){ + ids.add(inspectionInfo.getLeadManId()); + } + sendSocketMessage(ids); } //将节点状态改为已完成 @@ -346,7 +352,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(roleId); - sendSocketMessage(listByUserId); + List ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList()); + if (ObjectUtil.isNotNull(info.getLeadManId())){ + ids.add(info.getLeadManId()); + } + sendSocketMessage(ids); // 添加步骤信息表 InspectionStepInfo stepInfo = new InspectionStepInfo(); @@ -363,11 +373,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId) { - if (CollUtil.isNotEmpty(listByUserId)) { - for (UserDTO userDTO : listByUserId) { + public void sendSocketMessage(List userIds) { + if (CollUtil.isNotEmpty(userIds)) { + for (Long userId : userIds) { try { - inspectionSocket.sendMessage("接工单", userDTO.getId().toString()); + inspectionSocket.sendMessage("接工单", userId.toString()); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml index 5d85b81f..e98d3758 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml @@ -282,10 +282,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -- ii.status = '0' -- 工单正在进行中 -- ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致 -- AND iwn.status = '0' -- 流程节点状态为待开始 - iwn.role_id IN + (ii.lead_man_id = #{inspectionInfo.leadManId} + OR iwn.role_id IN #{roleId} - + ) AND ii.car_num like concat('%',#{inspectionInfo.carNum},'%') diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java index 7e0ab820..1ac91794 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.*; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.service.permission.RoleService; @@ -117,4 +118,16 @@ public class RoleController { return success(roleService.selectListByRoleId(role)); } + /** + * 通过角色code查询用户 + * @param code + * @return + */ + @GetMapping("/getUsersByRoleCode") + public CommonResult getUsersByRoleCode(String code){ + //获取当前登陆人的tenanId + Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId(); + return success(roleService.selectByRoleCode(tenantId,code)); + } + }