zoukankan      html  css  js  c++  java
  • 金蝶handler中 collection 代码片段理解

    1,AtsOverTimeBillBatchEditHandler中collection的理解

    1 SelectorItemCollection selectors = new SelectorItemCollection();
    2         //自定义集合SelectorItemCollection的定义
    3         selectors.add(new SelectorItemInfo("id"));        //集合selectors中添加id
    4         selectors.add(new SelectorItemInfo("name"));    //集合selectors中添加name
    5         viewInfo.setSelector(selectors);                //给viewInfo设置属性
    6         viewInfo.setFilter(temFilterInfo);                //给viewInfo设置过滤条件

     2.

    整个代码片段的理解

     1 protected void afterCreateNewModel(HttpServletRequest request, HttpServletResponse response, CoreBaseInfo coreBaseInfo)
     2     throws WafException
     3     //这就是HTTP协议的请求和响应对象
     4   {
     5     super.afterCreateNewModel(request, response, coreBaseInfo);
     6         //Super: 代表当前对象父类的引用
     7     AtsOverTimeBillInfo atsOverTimeBillInfo = (AtsOverTimeBillInfo)coreBaseInfo;//对coreBaseInfo的格式改变
     8     Date nowDate = DateTimeUtils.truncateDate(new Date());   //用这个方式获取当前时间
     9 
    10     PersonInfo personInfo = SHRBillUtil.getCurrPersonInfo();//获取personInfo(个人信息)
    11     PersonPositionInfo personPositionInfo = SHRBillUtil.getAdminOrgUnit(personInfo.getId().toString());
    12                 //获取personPositionInfo(职位信息)   getAdminOrgUnit(管理组织单元)
    13 
    14     atsOverTimeBillInfo.setProposer(personInfo);
    15     atsOverTimeBillInfo.setApplyDate(nowDate);
    16 
    17     atsOverTimeBillInfo.setAdminOrg(personPositionInfo.getPersonDep());
    18 
    19     HROrgUnitInfo hrInfo = null;
    20     hrInfo = ContextUtil.getCurrentHRUnit(this.ctx);
    21     atsOverTimeBillInfo.setHrOrgUnit(hrInfo);
    22     atsOverTimeBillInfo.setBizDate(nowDate);
    23 
    24     AtsOverTimeBillInfo overTimeBill = new AtsOverTimeBillInfo(); //新的对象overTimeBill
    25 
    26     boolean hasCodingRule = NumberCodeRule.hasCodingRule(overTimeBill, NumberCodeRule.getMainOrgByCu());//编码规则
    27     if (hasCodingRule == true) { 
    28       Map initData = (Map)request.getAttribute("view_initData");
    29       initData.put("overtimeBillNumberFieldCanEdit", Boolean.valueOf(false));
    30     }
    31 
    32     AtsOverTimeBillEntryInfo entryInfo = new AtsOverTimeBillEntryInfo(); //BOS中接口,用来设置值
    33     entryInfo.setAdminOrgUnit(personPositionInfo.getPersonDep());
    34     entryInfo.setPerson(personInfo);
    35     entryInfo.setPosition(personPositionInfo.getPrimaryPosition());
    36     entryInfo.setOtDate(nowDate);
    37     entryInfo.setApplyOTTime(BigDecimal.valueOf(0L));
    38     entryInfo.setRealOTTime(BigDecimal.valueOf(0L));
    39     entryInfo.setCreateTag(OverTimeCreateTag.userCreate);
    40     try
    41     {
    42       EntityViewInfo entityViewInfo = new EntityViewInfo();            //BOS中接口
    43       SelectorItemCollection sic = new SelectorItemCollection();    //集合
    44       sic.add(new SelectorItemInfo("proposer.id"));                    //设置属性
    45       sic.add(new SelectorItemInfo("id"));
    46       sic.add(new SelectorItemInfo("attendDate"));
    47       sic.add(new SelectorItemInfo("dayType"));
    48       entityViewInfo.setSelector(sic);                                //这个指定entityViewInfo的属性是sic中的
    49       FilterInfo filterInfo = new FilterInfo();                        //过滤条件代码块
    50       filterInfo.getFilterItems().add(new FilterItemInfo("proposer.id", personInfo.getId().toString()));
    51       filterInfo.getFilterItems().add(new FilterItemInfo("attendDate", nowDate, CompareType.GREATER_EQUALS));
    52       entityViewInfo.setFilter(filterInfo);
    53       //计划改变集合
    54       ScheduleShiftCollection coll = ScheduleShiftFactory.getRemoteInstance().getScheduleShiftCollection(entityViewInfo);
    55       OverTimeTypeInfo defaultType = new OverTimeTypeInfo();//defaultType(缺省类型)
    56       if ((coll != null) && (coll.size() >= 1)) {            //这些if-else 组合,就是确定是什么加班类型.
    57         int dayType = coll.get(0).getDayType().getValue();    //dayType赋值
    58 
    59         if (dayType == 1) {
    60           defaultType.setName("休息日加班");
    61           defaultType.setNumber("002");
    62           defaultType.setId(BOSUuid.read("zr+ur5D4RA+2bdVZ2VPqp46C/nU="));
    63         } else if (dayType == 2) {
    64           defaultType.setName("法定节假日加班");
    65           defaultType.setNumber("003");
    66           defaultType.setId(BOSUuid.read("sRWUOt7sRpOY0TCo6NMqGY6C/nU="));
    67         } else {
    68           defaultType.setName("工作日加班");
    69           defaultType.setNumber("001");
    70           defaultType.setId(BOSUuid.read("rBy0u1YgQ9C1OxcM85mxyY6C/nU="));
    71         }
    72       }
    73       else {
    74         defaultType.setName("休息日加班");
    75         defaultType.setNumber("002");
    76         defaultType.setId(BOSUuid.read("zr+ur5D4RA+2bdVZ2VPqp46C/nU="));
    77       }
    78       entryInfo.setOtType(defaultType);  //赋值给,entryInfo,以便后面操作
    79     } catch (BOSException e1) {            //捕捉错误的标准语句
    80       e1.printStackTrace();
    81     }
    82     try
    83     {        //工厂-本地实例-补充集合里面的
    84       OverTimeCompensCollection overTimeCompensCollection = OverTimeCompensFactory.getLocalInstance(this.ctx).getOverTimeCompensCollection(" ");
    85       int size = overTimeCompensCollection.size();
    86       for (int i = 0; i < size; i++)
    87         if ("调休".equals(overTimeCompensCollection.get(i).getName()))//这是判断有没有调休,有就添加进去
    88           entryInfo.setOtCompens(overTimeCompensCollection.get(i));
    89     }
    90     catch (BOSException e)        //捕捉错误的标准语句
    91     {
    92       e.printStackTrace();
    93     }
    94     atsOverTimeBillInfo.getEntries().add(entryInfo);  //找到对应的实体,把entryInfo,添加进去
    95   }
  • 相关阅读:
    Springx b 界面
    ETCD 分布式锁实现逻辑
    etcd 集群概述 转
    [转]MySQL性能优化
    Elasticsearch、MongoDB和Hadoop比较
    Mysql导出表格变成科学计数法的解决方案
    记一次laravel框架下的post请求测试
    Mysql语句优化记录
    laravel与MongoDB 的部分实践
    Laravel多数据库连接记录
  • 原文地址:https://www.cnblogs.com/todayforever/p/6650511.html
Copyright © 2011-2022 走看看