一段逻辑代码

//add by zengzw@曾志伟 2016年10月24日15:30:35  begin
          LfwView mainWidget = AppLifeCycleContext.current().getWindowContext().getViewContext("main").getView();
          Dataset ds = mainWidget.getViewModels().getDataset(getMasterDsId());
            String djlxbm_a = (String)AppUtil.getAppAttr(IExpConst.DEFAULT_DJLXBM);
            if("264X-Cxx-0001".equals(djlxbm_a)
                    ||"264X-Cxx-0002".equals(djlxbm_a)
                    ||"264X-Cxx-0005".equals(djlxbm_a)
                    ||"264X-Cxx-0038".equals(djlxbm_a)){
                Integer state =  (Integer) AppLifeCycleContext.current().getApplicationContext().getAppSession().getAttribute("workflow_type");
                if(AppUtil.getAppAttr("isfromssc") != null && "Y".equalsIgnoreCase((String)AppUtil.getAppAttr("isfromssc"))
                        && state == 6){
                    Row row = ds.getSelectedRow();
                    //共享初审的时候保存按钮可用
                    Object test = AppUtil.getAppAttr("result");//确保拿的比较的金额一直是第一次数据库中的值
                    if(!"".equals(test) &&test != null) {
                        UFDouble amount = (UFDouble) row.getValue(ds.nameToIndex("total"));
                        UFDouble fina = (new UFDouble(test.toString())).sub(amount);
                        if(fina.toDouble() > 300 || fina.toDouble() < 0){
                            throw new LfwRuntimeException("修改金额只能下浮小于或等于300元"); 
                        }
                    }else {
                        String djbh = (String) row.getValue(ds.nameToIndex("djbh"));
                        if(djbh != null && djbh.length() > 0 ) {
                            String sql = " select a.total from ncdata.er_bxzb a where a.djbh = '"+djbh+"'";
                            Object result;
                            try {
                                result = (Object) getQuery().executeQuery(sql, new ColumnProcessor());
                                if(!"".equals(result) && result != null){
                                    AppUtil.addAppAttr("result", result.toString());                                    
                                    UFDouble amount = (UFDouble) row.getValue(ds.nameToIndex("total"));
                                    UFDouble fina = (new UFDouble(result.toString())).sub(amount);
                                    if(fina.toDouble() > 300 || fina.toDouble() < 0){
                                        throw new LfwRuntimeException("修改金额只能下浮小于或等于300元"); 
                                    }
                                }
                            } catch (BusinessException e) {
                                // TODO Auto-generated catch block
                                Debug.debug(e.getMessage());
                            }                            
                        }
                    }                    
                }else{                    
                }
            }
            //add by zengzw@曾志伟 2016年10月24日15:30:35  end
---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
原文地址:https://www.cnblogs.com/zzzzw/p/5997932.html