From 4662ae356e9d6d871e8da2beab8356d43a835dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Thu, 14 Nov 2024 17:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/InspectionSocket.java | 34 ++++++++- .../controller/InspectionInfoController.java | 13 ++++ .../controller/PartnerOwnController.java | 3 +- .../inspection/entity/InspectionInfo.java | 2 + .../mapper/InspectionWorkNodeMapper.java | 2 + .../service/IInspectionWorkNodeService.java | 7 ++ .../impl/AppInspectionPartnerServiceImpl.java | 5 ++ .../impl/InspectionInfoServiceImpl.java | 2 + .../impl/InspectionWorkNodeServiceImpl.java | 33 ++++++++- .../inspection/vo/InspectionInfoVo.java | 3 + .../mapper/InspectionWorkNodeMapper.xml | 5 ++ .../inspection/InspectionInfoMapper.xml | 70 +++++++++++-------- 12 files changed, 143 insertions(+), 36 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java index 1554b927..a98cb262 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/InspectionSocket.java @@ -9,7 +9,11 @@ import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; import java.io.IOException; +import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.LinkedBlockingQueue; /**`1 @@ -88,12 +92,36 @@ public class InspectionSocket { * 发送给指定的用户 * @param message */ - public void sendMessage(String message, String userId) throws IOException { - if (sessionMap.containsKey(userId)){ + private final Map> messageQueueMap = new ConcurrentHashMap<>(); + + public void sendMessage(String message, String userId) { + if (sessionMap.containsKey(userId)) { Session session = sessionMap.get(userId); - session.getAsyncRemote().sendText(message); + messageQueueMap.putIfAbsent(userId, new LinkedBlockingQueue<>()); + + // 将消息加入用户的队列 + messageQueueMap.get(userId).offer(message); + + // 异步处理消息队列 + processQueue(session, userId); } } + private void processQueue(Session session, String userId) { + BlockingQueue queue = messageQueueMap.get(userId); + + CompletableFuture.runAsync(() -> { + String nextMessage; + while ((nextMessage = queue.poll()) != null) { + session.getAsyncRemote().sendText(nextMessage, result -> { + if (!result.isOK()) { + System.err.println("Message sending failed for user: " + userId); + } + }); + } + }); + } + + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java index adb7f370..8bfb43f0 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java @@ -137,6 +137,19 @@ public class InspectionInfoController extends BaseController { return success("接单成功"); } + /** + * 员工取消接单 + * + * @param inspectionId 工单id + * @param workNodeId 节点id (geStelectInspection这个方法中返回了) + * @return + */ + @PostMapping("cancelAnOrder") + public CommonResult cancelAnOrder(Integer inspectionId, String workNodeId) { + inspectionWorkNodeService.cancelAnOrder(inspectionId, workNodeId); + return success("接单成功"); + } + /** * 项目操作(退办理、重审、项目完成) * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java index 464dea4b..b257ef81 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java @@ -539,8 +539,9 @@ public class PartnerOwnController extends BaseController { @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); + // .eq(PartnerWorker::getUserId,user.getId()) LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerWorker::getUserId,user.getId()).eq(PartnerWorker::getPartnerId,partnerId); + queryWrapper.eq(PartnerWorker::getPartnerId,partnerId); PartnerWorker worker = partnerWorkerService.getOne(queryWrapper); if (ObjectUtil.isEmpty(worker)){ return null; 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 5a5f52fd..a7778deb 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 @@ -161,4 +161,6 @@ public class InspectionInfo extends TenantBaseDO private String workNodeStatus; @TableField(exist = false) private String selectType; + @TableField(exist = false) + private String projectName; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java index 3340c22a..50e9d5f0 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java @@ -29,4 +29,6 @@ public interface InspectionWorkNodeMapper extends BaseMapper IPage getRoyaltyList(@Param("page")IPage page,@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode); Map getRoyaltySum(@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode); + + void cancelAnOrder(InspectionWorkNode workNode); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java index d1d16fb2..e838d732 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java @@ -23,6 +23,13 @@ public interface IInspectionWorkNodeService extends IService */ void updateInspectionWorkNode(Integer inspectionId, String workNodeId); + /** + * 员工取消接单 + * @param inspectionId + * @param workNodeId + */ + void cancelAnOrder(Integer inspectionId, String workNodeId); + /** * 更新流程图片 步骤信息 * @param inspectionWorkNode diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java index 0db942eb..69bb9f37 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java @@ -119,6 +119,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl partnerList(Page page, PartnerListQuery partnerListQuery) { @@ -1495,6 +1497,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl workNodes = inspectionWorkNodeService.getWeorkNodesById(Integer.parseInt(String.valueOf(inspectionInfoId))); + res.setWorkNodes(workNodes); return res; } 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 e287950c..42f707b9 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 @@ -251,6 +251,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl workNodes; } diff --git a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml index 67fd11ec..c5afee77 100644 --- a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml @@ -1,6 +1,11 @@ + + UPDATE inspection_work_node + SET status = '0', deal_user_id = null, deal_user_name = null, deal_images = null, remark = null + WHERE id = #{id} AND inspection_info_id = #{inspectionInfoId} + -