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用法示例

    『愿你我既可以朝九晚五,又能够浪迹天涯』
  • 相关阅读:
    nginx配置zabbix下setup.php(web页面)无法显示,浏览器无法打开
    CentOS release 6.5下jdk1.7升级到1.8
    tcp流量控制
    图像处理服务器
    muduo rpc protobuf 实现学习
    p2p nat 穿透原理
    博客-livevent-stl-cpp-nginx
    使用eventfd创建一个用于事件通知的文件描述符
    多线程设计的类的思考!
    ftp协议服务器与tinyhttp服务demo
  • 原文地址:https://www.cnblogs.com/zjwwljty/p/5555288.html
Copyright © 2011-2022 走看看