From 7f1e4425bb165ecc4ad324a22e7ef56a36165b4d Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Tue, 30 Dec 2025 17:44:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(andon):=20=E4=BF=AE=E5=A4=8D=E5=AE=89?= =?UTF-8?q?=E7=81=AF=E4=BA=8B=E4=BB=B6=E6=B4=BE=E5=B7=A5=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=92=8C=E8=87=AA=E5=8A=A8=E5=88=86=E9=85=8D?= =?UTF-8?q?=E9=80=BB=E8=BE=91,=20=E5=BD=93PDA=E4=BD=BF=E7=94=A8/production?= =?UTF-8?q?/andon/mobile/call=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4=E5=AE=89?= =?UTF-8?q?=E7=81=AF=E5=91=BC=E5=8F=AB=E6=97=B6=EF=BC=8C=E5=B0=86=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=AE=89=E7=81=AF=E6=B4=BE?= =?UTF-8?q?=E5=B7=A5AndonEventAssignment=E7=9A=84acceptTime=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E5=AE=89=E7=81=AF=E4=BA=8B=E4=BB=B6=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=90=8E=E8=AE=BE=E7=BD=AE=E6=97=B6=E9=97=B4=E4=B8=BA=E5=AE=89?= =?UTF-8?q?=E7=81=AF=E6=B4=BE=E5=B7=A5AndonEventAssignment=E7=9A=84finishT?= =?UTF-8?q?ime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除ACCEPTED状态下的acceptTime自动设置逻辑,仅保留DONE状态的finishTime设置 - 重命名autoCreateAssignments方法中的参数名从e改为event以提高可读性 - 在PDA调用场景下为自动创建的派工记录立即设置acceptTime表示已接单 - 更新变量名从a改为assignment,提高代码可读性 - 修复方法内部对event对象的引用保持一致性 --- .../impl/AndonEventAssignmentServiceImpl.java | 5 +- .../service/impl/AndonEventServiceImpl.java | 52 ++++++++++--------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventAssignmentServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventAssignmentServiceImpl.java index 27d0b7c..f516a34 100644 --- a/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventAssignmentServiceImpl.java +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventAssignmentServiceImpl.java @@ -88,9 +88,8 @@ public class AndonEventAssignmentServiceImpl implements IAndonEventAssignmentSer // 根据状态补充派工自身的里程碑时间 if (andonEventAssignment.getStatus() != null) { String status = andonEventAssignment.getStatus(); - if (AnDonConstants.AssignmentStatus.ACCEPTED.equals(status) && andonEventAssignment.getAcceptTime() == null) { - andonEventAssignment.setAcceptTime(DateUtils.getNowDate()); - } else if (AnDonConstants.AssignmentStatus.DONE.equals(status) && andonEventAssignment.getFinishTime() == null) { + // 当状态变为DONE时,设置finishTime为当前时间(安灯事件结束) + if (AnDonConstants.AssignmentStatus.DONE.equals(status) && andonEventAssignment.getFinishTime() == null) { andonEventAssignment.setFinishTime(DateUtils.getNowDate()); } } diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventServiceImpl.java index fd2b664..81d82c9 100644 --- a/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventServiceImpl.java +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/AndonEventServiceImpl.java @@ -182,12 +182,12 @@ public class AndonEventServiceImpl implements IAndonEventService /** * 根据规则为事件生成派工记录(优先 NOTIFY_USERS,其次 NOTIFY_ROLES)。 */ - private void autoCreateAssignments(AndonEvent e) { - if (e == null || e.getEventId() == null) return; + private void autoCreateAssignments(AndonEvent event) { + if (event == null || event.getEventId() == null) return; AndonRule query = new AndonRule(); - query.setCallTypeCode(e.getCallTypeCode()); + query.setCallTypeCode(event.getCallTypeCode()); query.setIsFlag(AnDonConstants.FLAG_VALID); - AndonRule rule = pickBestRule(andonRuleMapper.selectAndonRuleList(query), e); + AndonRule rule = pickBestRule(andonRuleMapper.selectAndonRuleList(query), event); if (rule == null) return; Date now = DateUtils.getNowDate(); @@ -199,18 +199,20 @@ public class AndonEventServiceImpl implements IAndonEventService if (notEmpty(rule.getNotifyUsers())) { String[] ids = rule.getNotifyUsers().split(","); for (int i = 0; i < ids.length; i++) { - String t = ids[i] == null ? null : ids[i].trim(); - if (!notEmpty(t)) continue; + String userIdStr = ids[i] == null ? null : ids[i].trim(); + if (!notEmpty(userIdStr)) continue; try { - Long uid = Long.valueOf(t); - AndonEventAssignment a = new AndonEventAssignment(); - a.setEventId(e.getEventId()); - a.setAssigneeUserId(uid); - a.setAssignedTime(now); - a.setStatus(AnDonConstants.AssignmentStatus.ASSIGNED); - a.setIsFlag(AnDonConstants.FLAG_VALID); - a.setCreateTime(now); - andonEventAssignmentMapper.insertAndonEventAssignment(a); + Long uid = Long.valueOf(userIdStr); + AndonEventAssignment assignment = new AndonEventAssignment(); + assignment.setEventId(event.getEventId()); + assignment.setAssigneeUserId(uid); + assignment.setAssignedTime(now); + assignment.setStatus(AnDonConstants.AssignmentStatus.ASSIGNED); + // PDA调用时立即设置acceptTime(表示PDA已接单) + assignment.setAcceptTime(now); + assignment.setIsFlag(AnDonConstants.FLAG_VALID); + assignment.setCreateTime(now); + andonEventAssignmentMapper.insertAndonEventAssignment(assignment); created = true; if ("single".equals(mode)) break; // 单人模式:仅创建一个派工 } catch (Exception ignore) { } @@ -222,20 +224,22 @@ public class AndonEventServiceImpl implements IAndonEventService for (int i = 0; i < roles.length; i++) { String rk = roles[i] == null ? null : roles[i].trim(); if (!notEmpty(rk)) continue; - AndonEventAssignment a = new AndonEventAssignment(); - a.setEventId(e.getEventId()); - a.setAssigneeRoleKey(rk); - a.setAssignedTime(now); - a.setStatus(AnDonConstants.AssignmentStatus.ASSIGNED); - a.setIsFlag(AnDonConstants.FLAG_VALID); - a.setCreateTime(now); - andonEventAssignmentMapper.insertAndonEventAssignment(a); + AndonEventAssignment assignment = new AndonEventAssignment(); + assignment.setEventId(event.getEventId()); + assignment.setAssigneeRoleKey(rk); + assignment.setAssignedTime(now); + assignment.setStatus(AnDonConstants.AssignmentStatus.ASSIGNED); + // PDA调用时立即设置acceptTime(表示PDA已接单) + assignment.setAcceptTime(now); + assignment.setIsFlag(AnDonConstants.FLAG_VALID); + assignment.setCreateTime(now); + andonEventAssignmentMapper.insertAndonEventAssignment(assignment); created = true; if ("single".equals(mode)) break; } } if (created) { - logEvent(e.getEventId(), AnDonConstants.Operation.ASSIGN, "根据规则创建派工记录"); + logEvent(event.getEventId(), AnDonConstants.Operation.ASSIGN, "根据规则创建派工记录"); } }