eas_批量更新组织长编码,长名称
protected void rebuildOrgStructureDisplayName(Context ctx) throws BOSException { /* 555 */ Connection conn = null; /* 556 */ Statement stmt = null; /* 557 */ PreparedStatement pstmt = null; /* 558 */ ResultSet rs = null; /* */ /* 560 */ List elemList = new ArrayList(); /* 561 */ HashMap map = new HashMap(); /* */ /* 563 */ String selectSql = new StringBuffer().append("SELECT struc.FID, struc.FParentID, unit.FNumber, unit.FName_L1, unit.FName_L2, unit.FName_L3 ") .append("FROM T_ORG_Structure struc INNER JOIN T_ORG_BaseUnit unit ON struc.FUnitID = unit.FID ") .append("ORDER BY struc.FLongNumber, struc.FID").toString(); /* */ /* */ /* */ /* 567 */ String updateSql = "UPDATE T_ORG_Structure SET FLongNumber = ?, FDisplayName_L1 = ?, FDisplayName_L2 = ?, FDisplayName_L3 = ? WHERE FID = ?"; /* */ try /* */ { /* 570 */ conn = getConnection(ctx); /* 571 */ stmt = conn.createStatement(); /* 572 */ rs = stmt.executeQuery(selectSql); /* */ /* 574 */ while (rs.next()) { /* 575 */ String id = rs.getString(1); /* 576 */ String parentId = rs.getString(2); /* 577 */ String number = rs.getString(3); /* 578 */ String name_l1 = rs.getString(4); /* 579 */ String name_l2 = rs.getString(5); /* 580 */ String name_l3 = rs.getString(6); /* */ /* 582 */ ListElement elem = new ListElement(id, parentId, number, name_l1, name_l2, name_l3); /* 583 */ elemList.add(elem); /* */ } /* */ } catch (Exception e) { /* */ } /* */ finally { /* 588 */ SQLUtils.cleanup(rs, stmt, conn); /* */ } /* */ try /* */ { /* 592 */ conn = getConnection(ctx); /* 593 */ pstmt = conn.prepareStatement(updateSql); /* */ /* 595 */ for (int i = 0; i < elemList.size(); ++i) { /* 596 */ ListElement elem = (ListElement)elemList.get(i); /* 597 */ String id = elem.id; /* 598 */ String parentId = elem.parentId; /* 599 */ String number = elem.number; /* 600 */ String name_l1 = elem.name_l1; /* 601 */ String name_l2 = elem.name_l2; /* 602 */ String name_l3 = elem.name_l3; /* */ /* 604 */ if (parentId != null) { /* 605 */ DisplayName dis = (DisplayName)map.get(parentId); /* */ /* 607 */ if (dis == null) { /* 608 */ StringBuffer errerInfor = new StringBuffer(); /* 609 */ errerInfor.append("---***_rebuildOrgStructureDisplayName***---\n").append("id = ").append(id).append("\n").append("parentId = ").append(parentId).append("\n").append("number = ").append(number).append("\n"); /* */ /* */ /* */ /* 613 */ continue; /* */ } /* */ /* 616 */ if ((dis.longNumber == null) || (number == null)) /* 617 */ number = null; /* */ else { /* 619 */ number = dis.longNumber + "!" + number; /* */ } /* 621 */ if ((dis.displayName_l1 == null) || (name_l1 == null)) /* 622 */ name_l1 = null; /* */ else { /* 624 */ name_l1 = dis.displayName_l1 + "_" + name_l1; /* */ } /* 626 */ if ((dis.displayName_l2 == null) || (name_l2 == null)) /* 627 */ name_l2 = null; /* */ else { /* 629 */ name_l2 = dis.displayName_l2 + "_" + name_l2; /* */ } /* 631 */ if ((dis.displayName_l3 == null) || (name_l3 == null)) /* 632 */ name_l3 = null; /* */ else { /* 634 */ name_l3 = dis.displayName_l3 + "_" + name_l3; /* */ /* */ /* */ /* */ /* */ /* */ } /* */ /* */ } /* */ /* 644 */ map.put(id, new DisplayName(number, name_l1, name_l2, name_l3)); /* 645 */ pstmt.setString(1, number); /* 646 */ pstmt.setString(2, name_l1); /* 647 */ pstmt.setString(3, name_l2); /* 648 */ pstmt.setString(4, name_l3); /* 649 */ pstmt.setString(5, id); /* */ /* 651 */ pstmt.addBatch(); /* */ } /* 653 */ pstmt.executeBatch(); /* */ } /* */ catch (Exception e) { /* 656 */ if (e.getCause() instanceof SQLException); /* */ /* */ /* 659 */ throw new BOSException(e); /* */ } finally { /* 661 */ SQLUtils.cleanup(pstmt, conn); /* */ } /* */ } /* */ private class ListElement /* */ { /* 666 */ String id = null; /* 667 */ String parentId = null; /* 668 */ String number = null; /* 669 */ String name_l1 = null; /* 670 */ String name_l2 = null; /* 671 */ String name_l3 = null; /* */ /* 673 */ String unitId = null; /* 674 */ boolean isCu = false; /* */ /* 676 */ String longNumber = null; /* */ /* */ public ListElement(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6) /* */ { /* 680 */ this.id = paramString1; /* 681 */ this.parentId = paramString2; /* 682 */ this.number = paramString3; /* 683 */ this.name_l1 = name_l1; /* 684 */ this.name_l2 = paramString5; /* 685 */ this.name_l3 = paramString6; /* */ } /* */ /* */ /* */ public ListElement(String paramString1, String paramString2, String paramString3, boolean paramBoolean) /* */ { /* 691 */ this.id = paramString1; /* 692 */ this.parentId = paramString2; /* 693 */ this.unitId = unitId; /* 694 */ this.isCu = paramBoolean; /* */ } /* */ /* */ public ListElement(String paramString1, String paramString2, String paramString3, String paramString4) /* */ { /* 699 */ this.id = paramString1; /* 700 */ this.longNumber = paramString2; /* 701 */ this.number = number; /* 702 */ this.parentId = paramString4; /* */ } /* */ } /* */ /* */ private class DisplayName /* */ { /* 708 */ String longNumber = null; /* 709 */ String displayName_l1 = null; /* 710 */ String displayName_l2 = null; /* 711 */ String displayName_l3 = null; /* */ /* */ DisplayName(String paramString1, String paramString2, String paramString3, String paramString4) { /* 714 */ this.longNumber = paramString1; /* 715 */ this.displayName_l1 = paramString2; /* 716 */ this.displayName_l2 = displayName_l2; /* 717 */ this.displayName_l3 = paramString4; /* */ }/* */ } private void updateChildrenByNameUpdated(Context ctx, IObjectValue model, String oldDisplayName, String oldLongNumber) /* */ throws BOSException, EASBizException /* */ { /* 1401 */ TreeBaseInfo treeBaseInfo = (TreeBaseInfo)model; ///* 1402 */ String displayName = treeBaseInfo.getDisplayName(locale); /* */ /* */ ///* 1405 */ if (displayName == null) ///* */ { ///* 1407 */ return; ///* */ } /* */ /* 1410 */ FilterItemInfo item = new FilterItemInfo("longNumber", treeBaseInfo.getLongNumber() + "!" + "%", CompareType.LIKE); /* */ /* */ /* 1413 */ FilterInfo filter = new FilterInfo(); /* 1414 */ filter.getFilterItems().add(item); /* 1415 */ EntityViewInfo view = new EntityViewInfo(); /* 1416 */ view.setFilter(filter); /* */ /* 1418 */ FilterInfo filterCU = getFilterForDefaultCU(ctx, treeBaseInfo); /* 1419 */ if (FilterUtility.hasFilterItem(filterCU)) /* */ { /* 1421 */ view.getFilter().mergeFilter(filterCU, "AND"); /* */ } /* 1423 */ TreeBaseCollection collection = getTreeBaseCollection(ctx, view); /* 1424 */ TreeBaseInfo temp = null; /* 1425 */ Iterator iter = collection.iterator(); /* 1426 */ while (iter.hasNext()) /* */ { /* 1428 */ temp = (TreeBaseInfo)iter.next(); ///* 1429 */ if (oldDisplayName != null) ///* */ { ///* 1431 */ if (temp.getDisplayName(locale) != null) ///* */ { ///* 1433 */ if (temp.getDisplayName(locale).indexOf(oldDisplayName) > 1) return; ///* */ ///* 1435 */ String temps = StringUtility.castRegular(oldDisplayName); ///* 1436 */ if (!(displayName.startsWith(temps))) ///* */ { ///* 1438 */ temp.setDisplayName(temp.getDisplayName(locale).replaceFirst(temps + "_", displayName + "_"), locale); ///* */ ///* */ } ///* */ ///* */ } ///* */ else ///* */ { ///* 1445 */ temp.setDisplayName(displayName, locale); ///* */ } ///* */ ///* */ } ///* */ else ///* */ { ///* 1451 */ temp.setDisplayName(displayName, locale); ///* */ } ///* 1453 */ limitDisplayNameLength(temp); /* 1454 */ super._update(ctx, new ObjectUuidPK(temp.getId()), temp); /* */ } /* */ }
linux下的docker操作命令及异常