From 5aa0d0c640fc6822f8ae7a4cb1249e3733097368 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Thu, 31 Aug 2023 22:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97(=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=89=93=E5=8D=B0=E9=80=BB=E8=BE=91=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?BUG=E8=A7=A3=E5=86=B3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ProOrderWorkorderServiceImpl.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index dba9b84a..fbdfd5bc 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -578,17 +578,31 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { List proOrderWorkorderList = new ArrayList(); // 查询该工单信息 ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); + proOrderWorkorderList.add(proOrderWorkorder); boolean flag = true; + + // 临时存放parentCode + StringBuilder tempCode = new StringBuilder(); + tempCode.append(proOrderWorkorder.getParentOrder()); + while (flag) { - proOrderWorkorderList.add(proOrderWorkorder); - ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder()); + ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(tempCode.toString()); if (workorder != null) { - BeanUtils.copyProperties(workorder,proOrderWorkorder); + proOrderWorkorderList.add(workorder); + tempCode.setLength(0); + tempCode.append(workorder.getParentOrder()); } else { flag = false; } } - return success(proOrderWorkorderList); + + // 反转list + List reversalWorkOrderList = new ArrayList<>(); + for (int i = proOrderWorkorderList.size()-1; i >= 0; i--) { + reversalWorkOrderList.add(proOrderWorkorderList.get(i)); + } + + return success(reversalWorkOrderList); } /**