首页 > 其他分享 >eas_批量更新组织长编码,长名称

eas_批量更新组织长编码,长名称

时间:2024-04-09 16:34:39浏览次数:15  
标签:编码 displayName String 批量 l2 l1 eas null name

   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);
/*      */     }
/*      */   }

 

标签:编码,displayName,String,批量,l2,l1,eas,null,name
From: https://www.cnblogs.com/ketoli/p/18124259

相关文章

  • asp.net KindEditor编辑器整合百度WebUploader插件批量上传图片
    集成背景说明多个图片进行批量上传新版本浏览器兼容性问题处理,原编辑器上传图片功能使用flash上传插件,由于最新版本浏览器不再支持flash,重新集成新的上传插件,对编辑器进行改造升级。一、KindEditor介绍KindEditor是一套开源的HTML可视化编辑器,主要用于让用户在网站上获得所见即......
  • 开发Element-UI的Table 组件列显示隐藏,列表数据勾选批量导出/全量导出,显示导出进度并
    #用法<TabColDisplay:total="total"api-url="hgp/order"api-name="hgpLocalList":s-param="listQuery":select-ids="selIds"title="快速......
  • URL详解与URL编码
    URL详解与URL编码 作为前端,每日与URL打交道是必不可少的。但是也许每天只是单纯的用,对其只是一知半解,随着工作的展开,我发现在日常抓包调试,接口调用,浏览器兼容等许多方面,不深入去理解URL与URL编码则会踩到很多坑。故写下此篇文章,详解一下URL。URL与URI很多人会混淆这......
  • 状压dp——Disease Manangement 疾病管理
    题目描述Alas!AsetofD(1<=D<=15)diseases(numbered1..D)isrunningthroughthefarm.FarmerJohnwouldliketomilkasmanyofhisN(1<=N<=1,000)cowsaspossible.IfthemilkedcowscarrymorethanK(1<=K<=D)differentd......
  • 批量转换pcd数据的编码形式:Binary转ASCII
    本文为CSDN晚意丶3D原创,转载请表明原文出处———————————————————————————————————————批量转换pcd数据的编码形式:Binary转ASCII代码结果相关内容pcd点云格式的编码有两种,分别是Binary和ASCIIBinary是二进制格式,用文......
  • GC机制+字符编码+文件操作
    深浅拷贝深浅拷贝问题1.1定义理解给一个列表,想基于这个列表进行更改生成一个新的列表。方式一:将原来列表复制一份一摸一样的只对新列表生效,对原来的不生效num_list=[1,2,3]num_list_new=[1,2,3]num_list_new.append(4)print(num_list)#[1,2,3]print(num_list_n......
  • NCI SEER breast cancer美国国立癌症研究所数据库乳腺癌生存分析和乳腺癌预测模型(202
    ​作者Toby,来源公众号:python生物信息学,美国国立癌症研究所数据库乳腺癌生存分析和乳腺癌预测模型NCI美国国立癌症研究所(NationalCancerInstitute,NCI)美国国立癌症研究所(NCI)是美国国家卫生研究院(NIH)的一个组成部分,致力于癌症研究和预防。以下是NCI的一些重要信息和职责:......
  • 基于FPGA的数据采集、编码、通讯和存储系统设计(即FPGA+RTL8211千兆以太网+SD卡存储+RT
    介绍一个小项目,加强对FPGA相关接口的整体把握。硬件及软件代码梳理:硬件系统的主要功能框图,其中FPGA作为处理单元,实现了包括电流和电压的采集、千兆以太网通讯、SD卡本地数据存储和串口通讯等。已经过板级测试,测试包含:千兆网通讯收发测试、AD采集的数据验证、SD卡存储验证......
  • 智慧安防系统EasyCVR视频汇聚平台接入大华设备无法语音对讲的原因排查与解决
    安防视频监控/视频集中存储/云存储/磁盘阵列EasyCVR平台支持7*24小时实时高清视频监控,能同时播放多路监控视频流,视频画面1、4、9、16个可选,支持自定义视频轮播。EasyCVR平台可拓展性强、视频能力灵活、部署轻快,可支持的主流标准协议有国标GB28181、RTSP/Onvif、RTMP等,以及支持厂家......
  • 字符编码
    数据存放位置内存如何将数据保存到硬盘字符编码计算机只能识别二进制将我们的文字转换为计算机可以识别的文字编码发展史一段:一家独大ASCII码表大写英文A到Z:65-90小写英文a到z:97-122数字0-9:48-57二段:诸侯割据基于ASCII码表扩展成各自国家的编码表GBK:中......