当前位置 : 主页 > 编程语言 > java >

查询科目,存在层级结构,要求以树形结构返回,easyUi解析处理

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt Columns: SUBJECTID, SUBJECTNUM, SUBJECTNAME, FULLNAME, UPPERROLE, SUBJECTTYPE, HASSUBROLE, MNEMONICCODE, SERIESNO== Row: 7259055, 01, 营业收入, null, 0, null, 00, YYSR, 1== Row: 7259056, 02, 营业成本, null, 0, null, 00
gistfile1.txt
Columns: SUBJECTID, SUBJECTNUM, SUBJECTNAME, FULLNAME, UPPERROLE, SUBJECTTYPE, HASSUBROLE, MNEMONICCODE, SERIESNO
<==        Row: 7259055, 01, 营业收入, null, 0, null, 00, YYSR, 1
<==        Row: 7259056, 02, 营业成本, null, 0, null, 00, YYCB, 1
<==        Row: 7259057, 03, 税金及附加, null, 0, null, 00, SJJFJ, 1
<==        Row: 7259058, 04, 人工成本, null, 0, null, 01, RGCB, 1
<==        Row: 7259066, 05, 可控费用, null, 0, null, 01, KKFY, 1
<==        Row: 7259078, 06, 固定资产折旧, null, 0, null, 00, GDZCZJ, 1
<==        Row: 7259079, 07, 专项, null, 0, null, 01, ZX, 1
<==        Row: 7258605, 08, 绩效工资, null, 0, null, 01, JXGZ, 1
<==        Row: 7258608, 09, 职能部门费用, null, 0, null, 01, ZNBMFY, 1
<==        Row: 7259059, 0401, 岗位工资, null, 04, null, 00, GWGZ, 2
<==        Row: 7259060, 0402, 津贴, null, 04, null, 00, JT, 2
<==        Row: 7259061, 0403, 五险一金, null, 04, null, 00, WXYJ, 2
<==        Row: 7259062, 0404, 年金, null, 04, null, 00, NJ, 2
<==        Row: 7259063, 0405, 线路考察费, null, 04, null, 00, XLKCF, 2
<==        Row: 7259064, 0406, 劳务派遣人员工资, null, 04, null, 00, LWPQRYGZ, 2
<==        Row: 7259065, 0407, 福利费(分摊), null, 04, null, 00, FLFFT, 2
<==        Row: 7259080, 0701, 办公场所费用, null, 07, null, 01, BGCSFY, 2
<==        Row: 7259088, 0702, IT技术费, null, 07, null, 01, ITJSF, 2
<==        Row: 7259104, 0703, 公共办公费用, null, 07, null, 01, GGBGFY, 
<==        Row: 7258604, 0712, 综合收益-投资收益, null, 07, null, 00, ZHSY-TZSY, 2
<==        Row: 7259081, 070101, 房租, null, 0701, null, 00, FZ, 3
<==        Row: 7259082, 070102, 房屋折旧, null, 0701, null, 00, FWZJ, 3
<==        Row: 7259083, 070103, 房屋装修及维护, null, 0701, null, 00, FWZXJWH, 3
<==        Row: 7259089, 070201, 维保费用, null, 0702, null, 01, WBFY, 3
<==        Row: 7259092, 070202, 宽带使用费及运维费, null, 0702, null, 01, KDSYFJYWF, 3
<==        Row: 7259096, 070203, 软件年费, null, 0702, null, 01, RJNF, 3
<==        Row: 7259105, 070301, 办公设备耗材及维修, null, 0703, null, 00, BGSBHCJWX, 3
<==        Row: 7259106, 070302, 办公设备租赁, null, 0703, null, 00, BGSBZL, 3
<==        Row: 7259107, 070303, 制作物, null, 0703, null, 00, ZZW, 3
<==        Row: 7259120, 070601, 福利经费, null, 0706, null, 01, FLJF, 3
<==        Row: 7259132, 070602, 党工团活动费, null, 0706, null, 01, DGTHDF, 3
<==        Row: 7259135, 070603, 保险费用及其他, null, 0706, null, 01, BXFYJQT, 3
<==        Row: 7259143, 070701, 折旧费用, null, 0707, null, 01, ZJFY, 3
<==        Row: 7259146, 070702, 培训费(日常及管理培训), null, 0707, null, 01, PXFRCJGLPX, 3
<==        Row: 7259150, 070703, 招聘费用, null, 0707, null, 01, ZPFY, 3
<==        Row: 7258568, 070704, 市场费用, null, 0707, null, 01, SCFY, 3
<==        Row: 7258581, 070705, 税金, null, 0707, null, 01, SJ, 3
<==        Row: 7258585, 070706, 旅行社责任险, null, 0707, null, 00, LXSZRX, 3
<==        Row: 7258586, 070707, 属地平台管理费用分摊, null, 0707, null, 00, SDPTGLFYFT, 3
<==        Row: 7258588, 070801, 汇兑损益, null, 0708, null, 00, HDSY, 3
<==        Row: 7258589, 070802, 利息收入, null, 0708, null, 00, LXSR, 3
<==        Row: 7258590, 070803, 其他财务费用, null, 0708, null, 00, QTCWFY, 3
<==        Row: 7258592, 070901, 酒店佣金, null, 0709, null, 00, JDYJ, 3
<==        Row: 7258593, 070902, 银联佣金, null, 0709, null, 00, YLYJ, 3
<==        Row: 7258594, 070903, 机票佣金, null, 0709, null, 00, JPYJ, 3
<==        Row: 7258595, 070904, 地接社佣金, null, 0709, null, 00, DJSYJ, 3
<==        Row: 7258596, 070905, 租金收入, null, 0709, null, 00, ZJSR, 3
<==        Row: 7258597, 070906, 其他业务, null, 0709, null, 00, QTYW, 3
<==        Row: 7258599, 071001, 政府补助收入, null, 0710, null, 00, ZFBZSR, 3
<==        Row: 7258600, 071002, 固定资产处置净收益, null, 0710, null, 00, GDZCCZJSY, 3
<==        Row: 7258601, 071003, 罚款净收益, null, 0710, null, 00, FKJSY, 3
<==        Row: 7258602, 071004, 其他营业外, null, 0710, null, 00, QTYYW, 3
<==        Row: 7259090, 07020101, 公司单独使用软件维保费用, null, 070201, null, 00, GSDDSYRJWBFY, 4
<==        Row: 7259121, 07060101, 三八妇女节, null, 070601, null, 00, SFNJ, 4
<==        Row: 7259122, 07060102, 儿童节, null, 070601, null, 00, ETJ, 4
<==        Row: 7259133, 07060201, 文体娱乐活动, null, 070602, null, 00, WTYLHD, 
<==        Row: 7259148, 07070202, 集团培训费分摊, null, 070702, null, 00, JTPXFFT, 4
<==        Row: 7259149, 07070203, 培训资助, null, 070702, null, 00, PXZZ, 4
<==        Row: 7259151, 07070301, 网络招聘费用, null, 070703, null, 00, WLZPFY, 4
<==        Row: 7258565, 07070302, 猎头服务费用, null, 070703, null, 00, LTFWFY, 4
<==        Row: 7258566, 07070303, 内部推荐奖励, null, 070703, null, 00, NBTJJL, 4
<==        Row: 7258567, 07070304, 校园招聘费用, null, 070703, null, 00, XYZPFY, 4
<==        Row: 7258574, 07070402, 市场推广费, null, 070704, null, 01, SCTGF, 4
<==        Row: 7258582, 07070501, 房产税, null, 070705, null, 00, FCS, 4
<==        Row: 7258583, 07070502, 土地使用税, null, 070705, null, 00, TDSYS, 4


public List
 
  > selectSubConfigListAsTree(Map
  
    map) throws Exception { List
   
    > resultMap= this.boFinSubConfigDao.selectSubConfigListAsTree(map); List
    
     > returnList = new ArrayList
     
      >(); for(Map
      
        map1 : resultMap){ if((map1.get("SERIESNO")+"").endsWith("1")){ Map
       
         newmap = new HashMap<>(); newmap.put("id", map1.get("SUBJECTNUM")+""); newmap.put("text", map1.get("SUBJECTNAME")+""); returnList.add(newmap); }else{ returnList = (List
        
         >) this.resolve(returnList,map1); } } return returnList; } //遍历查询,迭代 Object resolve(List
         
          > list,Map
          
            child){ for(Map
           
             map : list){ List
            
             > cList = (List
             
              >)map.get("children"); if(null != cList && cList.size() > 0){ if((child.get("UPPERROLE")+"").equals(map.get("id")+"")){ Map
              
                children = new HashMap<>(); children.put("id", child.get("SUBJECTNUM")); children.put("text", child.get("SUBJECTNAME")); cList.add(children); } resolve(cList,child); }else{ if((child.get("UPPERROLE")+"").equals(map.get("id")+"")){ List
               
                > ch = new ArrayList<>(); Map
                
                  children = new HashMap<>(); children.put("id", child.get("SUBJECTNUM")); children.put("text", child.get("SUBJECTNAME")); ch.add(children); map.put("state", "closed"); map.put("children", ch); } } } return list; } 返回结果: [ {id=01, text=营业收入}, {id=02, text=营业成本}, {id=03, text=税金及附加}, {children=[ {id=0401, text=岗位工资}, {id=0402, text=津贴}, {id=0406, text=劳务派遣人员工资}, {id=0407, text=福利费(分摊)}], id=04, text=人工成本, state=closed}, {children=[ {children=[ {id=070101, text=房租}, {id=070102, text=房屋折旧}, {id=070103, text=房屋装修及维护}, {id=070104, text=租摆费}, {id=070105, text=水电费}, {id=070106, text=物业费}, {id=070107, text=保洁费}], id=0701, text=办公场所费用, state=closed}, {children=[ {children=[ {id=07020101, text=单独使用软件维保费用}, {id=07020102, text=分摊费用}], id=070201, text=维保费用, state=closed}, {children=[ {id=07020201, text=折旧费用}, {id=07020202, text=公共分摊}, {id=07020203, text=本地宽带使用费和运维费}], id=070202, text=宽带使用费及运维费, state=closed}, {children=[ {id=07020301, text=adobe}, {id=07020302, text=微软软件}], id=070203, text=软件年费, state=closed}, {id=070204, text=系统费用化支出摊销费}, {children=[ {id=07020501, text=公司自用设备折旧费和无形资产摊销费}, {id=07020502, text=系统设备折旧费分摊}, {id=07020503, text=系统无形资产摊销费}], id=070205, text=信息系统设备折旧费和无形资产摊销费, state=closed}], id=0702, text=IT技术费, state=closed}], id=07, text=专项, state=closed} ]
                
               
              
             
            
           
          
         
        
       
      
     
    
   
  
 
网友评论