/** * 销售合同列表的实例 * * @param request jsp请求 * @param isApproveStat 是否在审批状态 * @return 返回销售合同列表的实例 */ public static B_ImportOrder getInstance(HttpServletRequest request) { B_ImportOrder b_ImportOrderBean = null; HttpSession session = request.getSession(true); synchronized (session) { String beanName = "b_ImportOrderBean"; b_ImportOrderBean = (B_ImportOrder) session.getAttribute(beanName); if (b_ImportOrderBean == null) { // 引用LoginBean LoginBean loginBean = LoginBean.getInstance(request); b_ImportOrderBean = new B_ImportOrder(); b_ImportOrderBean.qtyFormat = loginBean.getQtyFormat(); b_ImportOrderBean.priceFormat = loginBean.getPriceFormat(); b_ImportOrderBean.sumFormat = loginBean.getSumFormat(); b_ImportOrderBean.fgsid = loginBean.getFirstDeptID(); b_ImportOrderBean.loginId = loginBean.getUserID(); b_ImportOrderBean.loginName = loginBean.getUserName(); b_ImportOrderBean.user = loginBean.getUser(); session.setAttribute(beanName, b_ImportOrderBean); } } return b_ImportOrderBean; }
/** * 得到客户信誉额度信息的实例 * * @param request jsp请求 * @param isApproveStat 是否在审批状态 * @return 返回报价资料信息的实例 */ public static B_CustomerProductDiscount getInstance(HttpServletRequest request) { B_CustomerProductDiscount xs_khcpzkbean = null; HttpSession session = request.getSession(true); synchronized (session) { String beanName = "xs_khcpzkbean"; xs_khcpzkbean = (B_CustomerProductDiscount) session.getAttribute(beanName); // 判断该session是否有该bean的实例 if (xs_khcpzkbean == null) { LoginBean loginBean = LoginBean.getInstance(request); xs_khcpzkbean = new B_CustomerProductDiscount(); xs_khcpzkbean.fgsid = loginBean.getFirstDeptID(); xs_khcpzkbean.loginId = loginBean.getUserID(); xs_khcpzkbean.loginName = loginBean.getUserName(); xs_khcpzkbean.user = loginBean.getUser(); // 设置格式化的字段 xs_khcpzkbean.dsxs_khcpzkTable.setColumnFormat("zk", loginBean.getPriceFormat()); xs_khcpzkbean.dsxs_khcpzkTable.setColumnFormat("dj", loginBean.getPriceFormat()); xs_khcpzkbean.dsxs_khcpzkTable.setColumnFormat("bj", loginBean.getPriceFormat()); session.setAttribute(beanName, xs_khcpzkbean); } } return xs_khcpzkbean; }
@Test public void testGetTotalCostPerUser() throws SQLException, IOException { assertEquals(" should be 0.0", (Object) 0.0, costBean.getTotalCostPerUser(loginBean.getUser())); }