zoukankan      html  css  js  c++  java
  • 集合用例

    1. map用法示例:

      set - get ; 对象 - 对象的引用

     1     public List<OrganBatchFlowDTO> selectCompareList(
     2             Req_compareInfo_query record) {
     3 
     4         /** 1、查询日切流水表,得到记录*/
     5         List<OrganBatchFlowDTO> list= organBatchFlowDao.selectCompareList(dto);
     6         if(list==null ||list.size()<1){
     7             LOGGER.info("### step1: query from welink_adm_organ_batch_flow ,and size = 0");
     8             return new ArrayList<OrganBatchFlowDTO>();
     9         }
    10         /** 2、遍历,将记录存到 Map 中*/
    11         SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
    12         Map<String, OrganBatchFlowDTO> map = new HashMap <String, OrganBatchFlowDTO>();    
    13         for(OrganBatchFlowDTO t:list){
    14             if(StringUtils.equals(WftsAdmConstant.UP_ORGAN_NO, t.getOrgan_no())){
    15                 t.setOrgan_name("统一支付平台");
    16             }
    17             t.setSettleDate(fmt.format(t.getBatch_change_last_time()));
    18             t.setOrganNo(t.getOrgan_no());
    19             map.put(t.getOrgan_no()+fmt.format(t.getBatch_change_last_time()), t);
    20         }
    21         /** 3、查询对账待办事项,遍历,补齐字段*/
    22         List<CompareFileDTO> list2= compareFileDao.selectForCompare();
    23         
    24         if(list2.size()>0){
    25             for(CompareFileDTO t2:list2){
    26                 if(map.containsKey((t2.getOrganNo()+t2.getSettleDate())) && 
    27                         map.get((t2.getOrganNo()+t2.getSettleDate()))!=null ){
    28                     String key =t2.getOrganNo()+t2.getSettleDate() ;
    29                     map.get(key).setCompareStatus(t2.getComparStatus());
    30                     map.get(key).setTransType(t2.getTransType());
    31                 }
    32             }
    33         }        
    34         /** 4、查询对账文件列表,遍历,补齐字段*/
    35         List<FileStatusDTO> list3= fileStatusDao.selectForCompare();
    36         for(FileStatusDTO t3:list3){
    37             if(map.containsKey((t3.getOrganNo()+t3.getSettleDate())) && 
    38                     map.get((t3.getOrganNo()+t3.getSettleDate()))!=null ){
    39                 String key =t3.getOrganNo()+t3.getSettleDate() ;
    40                 map.get(key).setFileLineCount(t3.getFileLineCount());
    41                 map.get(key).setTotalAmount(t3.getTotalAmount());
    42                 map.get(key).setsFileLineCount(t3.getsFileLineCount());
    43                 map.get(key).setsTotalAmount(t3.getsTotalAmount());
    44                 map.get(key).setFileName(t3.getFileName());
    45                 map.get(key).setMd5Str(t3.getMd5Str());
    46                 map.get(key).setAccountDataAddr(t3.getAccountDataAddr());
    47             }
    48         }
    49         /** 
    50          * map 存的value是list当中的对象,map的value值改变,同时也改变list元素对象的值,
           * 所以最后可以返回改变后的list
    52
           */ 53 return list; 54 }

    2. set用法示例

    『愿你我既可以朝九晚五,又能够浪迹天涯』
  • 相关阅读:
    centos7下安装erlang
    centos7下升级git版本
    pytest失败重跑插件: pytest-rerunfailures使用与坑(全网独家精华)
    pytest-assume插件(全网最详细解释):多重断言执行
    pytest踩坑记:NameError: name 'pytest' is not defined
    pytest-ordering:指定pytest的case运行顺序的插件
    pytest中print的坑
    pytest测试入门篇(ExitCode退出码)
    httprunner3.x遇到的问题(hrun make报错)
    httprunner3.x(入门介绍篇)
  • 原文地址:https://www.cnblogs.com/zjwwljty/p/5555288.html
Copyright © 2011-2022 走看看