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 fb1c04b0..dc8c034a 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 @@ -8,11 +8,13 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket; import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.inspection.vo.DlInspectionWorkNodeVo; @@ -21,6 +23,7 @@ import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService; import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; 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.UserRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; @@ -86,6 +89,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(roleId); + if (CollUtil.isNotEmpty(listByUserId)) { + for (UserDTO userDTO : listByUserId) { + inspectionSocket.sendMessage("接工单", userDTO.getId().toString()); + } + } //检测步骤表插入检测开始 InspectionStepInfo stepInfo = new InspectionStepInfo(); 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 d74d7944..0db10cbf 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 @@ -1,9 +1,11 @@ package cn.iocoder.yudao.module.inspection.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket; import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject; import cn.iocoder.yudao.module.inspection.entity.InspectionInfo; import cn.iocoder.yudao.module.inspection.entity.InspectionStepInfo; @@ -13,7 +15,9 @@ import cn.iocoder.yudao.module.inspection.service.DlInspectionProjectService; import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService; import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService; import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService; +import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -23,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -44,6 +49,10 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl() .eq(DlInspectionProject::getId, workNode.getProjectId())); String stepTitle = ""; - if(ObjectUtil.isNotNull(project)) { + if (ObjectUtil.isNotNull(project)) { inspectionStepInfo.setTitle(project.getProjectName() + "项目检测完成"); - }else { + } else { inspectionStepInfo.setTitle("项目检测完成"); } if (ObjectUtil.isNotEmpty(inspectionWorkNode.getRemark())) { @@ -183,6 +192,10 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(nextNode.getRoleId()); + sendSocketMessage(listByUserId); } //将节点状态改为已完成 @@ -193,6 +206,15 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl inspectionWorkNodes, InspectionWorkNode workNode) { + for (InspectionWorkNode node : inspectionWorkNodes) { + if (node.getOrderNum() == workNode.getOrderNum() + 1) { + return node; + } + } + return null; + } + /** * 根据检测id获取流程信息 * @@ -302,7 +324,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId = roleService.getListByUserId(roleId); + sendSocketMessage(listByUserId); + // 添加步骤信息表 InspectionStepInfo stepInfo = new InspectionStepInfo(); stepInfo.setInspectionInfoId(Integer.parseInt(inspectionWorkNode.getInspectionInfoId().toString())); @@ -332,4 +359,16 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl listByUserId) { + if (CollUtil.isNotEmpty(listByUserId)) { + for (UserDTO userDTO : listByUserId) { + try { + inspectionSocket.sendMessage("接工单", userDTO.getId().toString()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + } } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java index a1a489cc..3fb1a488 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/UserRoleMapper.java @@ -42,4 +42,6 @@ public interface UserRoleMapper extends BaseMapperX { List selectByRoleCode(@Param("tenantId") Long tenantId, @Param("roleCode") String roleCode); IPage selectListByRoleId(@Param("page") Page page,@Param("role") RolePageReqVO role); + + List selectByRoleId(Integer roleId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java index 0c1ac00d..e0bc9022 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java @@ -175,4 +175,11 @@ public interface RoleService { * @return */ List getByUserId(Long userId); + + /** + * 根据角色id查询用户 + * @param roleId + * @return + */ + List getListByUserId(Integer roleId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java index 882d326e..73ff7d1b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java @@ -372,6 +372,18 @@ public class RoleServiceImpl implements RoleService { return userRoleDOS; } + /** + * 根据角色id查询用户 + * + * @param roleId + * @return + */ + @Override + public List getListByUserId(Integer roleId) { + List userDTOS = userRoleMapper.selectByRoleId(roleId); + return userDTOS; + } + /** * 获得自身的代理对象,解决 AOP 生效问题 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml index ced943c8..2ce71a7e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/UserRoleMapper.xml @@ -35,4 +35,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +