public static int Crateuser(HashMap<String, String> hm) throws ACDException { DBUtil db = null; try { db = DBUtil.getInstance(); String ID = db.insert(hm, "SeastarUsers"); String sql = "INSERT INTO UserRemainLeave(UserID) values(" + ID + ")"; db.execute(sql); String strEmail = "*****@*****.**"; String strSubject = "有outlook邮箱账号需要你开通"; // 问题紧急程度 String Sb = "陆斌你好!<br/>有outlook邮箱账号需要你开通" + "姓名为:" + hm.get("UserName") + "<br/>" + "邮箱为:" + hm.get("Email") + "<br/>"; GlobalFunc.sendEmail(strEmail, strSubject, Sb, 0); db.commitConn(); } catch (Exception e) { e.printStackTrace(); return -1; } finally { // db.close(); } return 1; }
/** * This method retrieve a Collection of Story with searching criteria. * * @param page * @param totalRows * @return * @throws Exception */ public static ArrayList<HashMap<String, String>> getList( HashMap<String, String> colhm, StringBuffer strWhere, ArrayList<String> paraList) throws Exception { String sql = " select count(a.ID) as iCon from " + tableName + " as a where 1=1" + strWhere; // 获取总行数 GlobalFunc.getPageCount(colhm, sql.toString(), paraList); sql = " a.*,b.DeptName,case when a.Status=-1 then '离职' when a.Status=0 then '在职' else '离职中' end as LZStatus " + " FROM " + tableName + " as a LEFT OUTER JOIN Department as b" + " on a.DeptID=b.ID WHERE 1=1 " + strWhere; return GlobalFunc.getListBySQL(colhm, sql.toString(), "a.id desc", paraList, 0); }
// 获得符合条件的发货人列表 @SuppressWarnings({"rawtypes", "unused"}) private String getSenderList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /* * pageRows:用户设置的每页显示条数 * pageIndex:页码 * totalNum:符合条件的总数据量 * totalPages:总共要显示多少页 */ String resultPage = "/beijing/base/sender_list.jsp"; // 获得页码 try { int pageIndex = 1; try { pageIndex = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE)); } catch (Exception ex) { pageIndex = 1; } // 获得用户设置的每页显示条数 String UserID = GlobalFunc.getUserID(request); int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request)); // 获得用户输入的发货人名称 String senderName = ""; if (request.getParameter("senderName") != null) { senderName = request.getParameter("senderName"); } // 获得符合条件的数据总量 int totalNum = SenderManager.getSenderTotalRows(senderName); // 根据数据总量和每页显示条数获得数据总页数 int totalPage = PageManager.getTotalPages(totalNum, pageRows); // 获得符合条件的某一个的数据 ArrayList senderList = SenderManager.getSenderList(pageRows, pageIndex, senderName); request.setAttribute(Constant.PARA_LIST, senderList); request.setAttribute("senderName", senderName); request.setAttribute(Constant.PARA_PAGEROWS, pageRows); request.setAttribute(Constant.PARA_CURPAGE, pageIndex); request.setAttribute(Constant.PARA_TOTALROWS, totalNum); request.setAttribute(Constant.PARA_TOTALPAGE, new Integer(totalPage)); } catch (ACDException e) { resultPage = Constant.ERROR_JSP; } catch (Exception e) { e.printStackTrace(); } return resultPage; }
// 为模块“付汇到付款”查询付汇管理单据 private String listFuHuiForPayment(HttpServletRequest request, HttpServletResponse response) { String resultPage = "/beijing/finance/FuHui2Payment_list.jsp"; try { int curPage = 1; try { curPage = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE)); } catch (Exception ex) { curPage = 1; } // 日期区间查询 // 获取查询条件 String colName = "minTime,maxTime,CustomerID,MandatorID,CurrencyID,ReceiverID,PaymentStatus"; HashMap<String, String> colhm = GlobalFunc.getHashMap4ChooseInfo(request, colName, 1); // 获取权限和用户设置 String menuID = "43"; int pageRows = GlobalFunc.getSettingAndRight(menuID, request, colhm); // 获取数量明细信息 ArrayList<HashMap<String, String>> Temp_List = payMoneyManager.listFuHuiForPayment(pageRows, curPage, colhm); request.setAttribute(Constant.PARA_LIST, Temp_List); // 返回查询结果给页面 request.setAttribute("colhm", colhm); // 返回查询条件和页面信息给页面 // 获取查询界面的下拉框 request.setAttribute("ReceiverList", GlobalFunction.getAllReceivers("")); request.setAttribute("MandatorList", GlobalFunction.getAllCustomers()); request.setAttribute("CustomerList", GlobalFunction.getAllCustomers()); request.setAttribute("CurrencyList", GlobalFunction.getAllCurrency("0")); } catch (Exception e) { GlobalFunc.printErrorInfo( getClass().getName(), request.getParameter("action"), GlobalFunc.getUserName(request)); e.printStackTrace(); request.setAttribute(Constant.ERROR_EXCEPTION, e.getMessage().toString()); resultPage = Constant.ERROR_PAGE; } return resultPage; }
// 付汇单据生成付款申请单 private String createFKCode(HttpServletRequest request, HttpServletResponse response) { String resultPage = "/ss/bj?disclass=Pay&action=listFuHuiForPayment"; try { String strIDs = request.getParameter("strID"); String UserID = GlobalFunc.getUserID(request); String DeptID = GlobalFunc.getDeptID(request); int iresult = payMoneyManager.createFKCode(strIDs, UserID, DeptID); if (iresult == 2) { request.setAttribute(Constant.ERROR_EXCEPTION, "生成失败!"); resultPage = Constant.ERROR_PAGE; } } catch (Exception e) { GlobalFunc.printErrorInfo( getClass().getName(), request.getParameter("action"), GlobalFunc.getUserName(request)); e.printStackTrace(); request.setAttribute(Constant.ERROR_EXCEPTION, e); resultPage = Constant.ERROR_JSP; } return resultPage; }
// 添加付汇单页面查找数据 @SuppressWarnings("unused") private String searchCustomerPayMoney(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String resultPage = "/beijing/finance/customerPayMoney_add.jsp"; try { int page = 1; try { page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE)); } catch (Exception ex) { page = 1; } String BrandID = ""; if (request.getParameter("BrandID") != null) { BrandID = request.getParameter("BrandID"); } String CustomerID = ""; if (request.getParameter("CustomerID") != null) { CustomerID = request.getParameter("CustomerID"); } String MandatorID = ""; if (request.getParameter("MandatorID") != null) { MandatorID = request.getParameter("MandatorID"); } String CurrencyID = ""; if (request.getParameter("CurrencyID") != null) { CurrencyID = request.getParameter("CurrencyID"); } // 付汇日期 String curDate = ""; if (request.getParameter("OrderTime") != null) { curDate = request.getParameter("OrderTime"); } // 付汇金额 String curMoney = ""; if (request.getParameter("Money") != null) { curMoney = request.getParameter("Money"); } String SenderID = ""; if (request.getParameter("SenderID") != null) { SenderID = request.getParameter("SenderID"); } String ReceiverID = ""; if (request.getParameter("ReceiverID") != null) { ReceiverID = request.getParameter("ReceiverID"); } // 获得已经选中的接收单Id,传回页面 String orderIds = ""; if (request.getParameter("orderIds") != null && request.getParameter("orderIds").length() > 0) { orderIds = request.getParameter("orderIds"); } // 选中了单据的钱的总和 String chooseMoney = ""; if (request.getParameter("chooseMoney") != null && request.getParameter("chooseMoney").length() > 0) { chooseMoney = request.getParameter("chooseMoney"); } // 选中了单据后剩余的钱 String remainMoney = ""; if (request.getParameter("remainMoney") != null && request.getParameter("remainMoney").length() > 0) { remainMoney = request.getParameter("remainMoney"); } HttpSession session = request.getSession(true); String strids = request.getParameter("strids"); session.removeAttribute("PayMoneyIDS"); session.setAttribute("PayMoneyIDS", strids); String UserID = GlobalFunc.getUserID(request); int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request)); int totalRows = payMoneyManager.getAddToPayReceiveOrderTotalRows( MandatorID, CustomerID, CurrencyID, BrandID, SenderID); int totalPage = PageManager.getTotalPages(totalRows, pageRows); ArrayList<?> Temp_List = payMoneyManager.getForFuHuiReceiveOrder( page, pageRows, MandatorID, CustomerID, CurrencyID, BrandID, SenderID); String totalUSDMoney = payMoneyManager.getRemainTotalMoney( MandatorID, CustomerID, CurrencyID, BrandID, SenderID); request.setAttribute("totalUSDMoney", totalUSDMoney); request.setAttribute(Constant.PARA_LIST, Temp_List); request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request)); request.setAttribute("CustomerID", CustomerID); request.setAttribute("MandatorID", MandatorID); request.setAttribute("SenderID", SenderID); request.setAttribute("CurrencyID", CurrencyID); request.setAttribute("ReceiverID", ReceiverID); request.setAttribute("BrandID", BrandID); request.setAttribute("curDate", curDate); request.setAttribute("curMoney", curMoney); request.setAttribute("orderIds", orderIds); request.setAttribute("remainMoney", remainMoney); request.setAttribute("chooseMoney", chooseMoney); request.setAttribute(Constant.PARA_CURPAGE, page); request.setAttribute(Constant.PARA_TOTALROWS, totalRows); request.setAttribute(Constant.PARA_TOTALPAGE, totalPage); request.setAttribute( "CustomerList", PageManager.getLimitData("BeiJingCustomer", "ID,ShortName", "Status!=-1")); request.setAttribute( "MandatorList", PageManager.getLimitData("BeiJingClient", "ID,ShortName", "Status!=-1")); request.setAttribute( "CurrencyList", PageManager.getLimitData("Currency", "ID,Currency", "Status!=-1")); request.setAttribute( "BrandList", PageManager.getLimitData("BeiJingJieSuanBrand", "ID,BrandName", "Status!=-1")); request.setAttribute( "ReceiverList", PageManager.getLimitData("BJPayee", "ID,PayeeName as ReceiverName", "Status!=-1")); request.setAttribute( "SenderList", PageManager.getLimitData("BeiJingSender", "ID,SenderName", "Status!=-1")); } catch (Exception e) { e.printStackTrace(); } return resultPage; }
// 添加核销单据之前准备数据 @SuppressWarnings("unused") private String toAddOrderForFuHui(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String resultPage = "/beijing/finance/customerPayMoney_edit.jsp"; try { int page = 1; try { page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE)); } catch (Exception ex) { page = 1; } // 根据ID获得付汇信息 HashMap<String, String> orderHM = payMoneyManager.getFuHuiInfo(request.getParameter("ID")); String CurrencyID = orderHM.get("CurrencyID").toString(); String MandatorID = orderHM.get("MandatorID").toString(); String CustomerID = orderHM.get("CustomerID").toString(); String BrandID = ""; if (request.getParameter("BrandID") != null && request.getParameter("BrandID").length() > 0) { BrandID = request.getParameter("BrandID"); } HttpSession session = request.getSession(true); String strids = request.getParameter("strids"); session.removeAttribute("PayMoneyIDS"); session.setAttribute("PayMoneyIDS", strids); double chooseMoney = 0.0; if (request.getParameter("chooseMoney") != null && request.getParameter("chooseMoney").toString().length() > 0) { chooseMoney = Double.parseDouble(request.getParameter("chooseMoney")); } double remainMoney = payMoneyManager.getFuHuiRemainMoney(orderHM, chooseMoney); remainMoney = PBMeth.round(remainMoney, 2); // 获得用户选择的接收单Id,传回页面 String orderIds = ""; if (request.getParameter("orderIds") != null && request.getParameter("orderIds").length() > 0) { orderIds = request.getParameter("orderIds"); } // chooseMoney = Double.parseDouble(orderHM.get("Money").toString()) - remainMoney; // 获得用户设置的每页显示行数 String UserID = GlobalFunc.getUserID(request); int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request)); // 根据付汇单信息获得可添加成核销的接收单数量 int totalRows = payMoneyManager.getAddToPayReceiveOrderTotalRows( MandatorID, CustomerID, CurrencyID, BrandID, ""); // 根据总数据量和每页显示行数得到总页数 int totalPage = PageManager.getTotalPages(totalRows, pageRows); // 获得可添加的接收单List ArrayList<?> Temp_List = payMoneyManager.getForFuHuiReceiveOrder( page, pageRows, MandatorID, CustomerID, CurrencyID, BrandID, ""); request.setAttribute(Constant.PARA_LIST, Temp_List); request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request)); request.setAttribute("remainMoney", String.valueOf(remainMoney)); request.setAttribute("chooseMoney", String.valueOf(chooseMoney)); request.setAttribute("orderIds", orderIds); request.setAttribute("OrderHM", orderHM); request.setAttribute("BrandID", BrandID); request.setAttribute(Constant.PARA_CURPAGE, page); request.setAttribute(Constant.PARA_TOTALROWS, totalRows); request.setAttribute(Constant.PARA_TOTALPAGE, totalPage); request.setAttribute("BrandList", GlobalFunction.getAllBJJieSuanBrand("0")); } catch (ACDException e) { request.setAttribute(Constant.ERROR_EXCEPTION, e); resultPage = Constant.ERROR_JSP; } catch (Exception e) { e.printStackTrace(); } return resultPage; }
// 根据条件获得某一页的付汇数据 private String getPayList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String resultPage = "/beijing/finance/customerPayMoney_list.jsp"; // 获得查询条件 try { int page = 1; try { page = Integer.parseInt(request.getParameter(Constant.PARA_CURPAGE)); } catch (Exception ex) { page = 1; } String minTime = ""; String strMinTime = ""; if (request.getParameter("minTime") != null && request.getParameter("minTime").length() > 0) { minTime = request.getParameter("minTime"); strMinTime = minTime + " 00:00:00"; } String maxTime = ""; String strMaxTime = ""; if (request.getParameter("maxTime") != null && request.getParameter("maxTime").length() > 0) { maxTime = request.getParameter("maxTime"); strMaxTime = maxTime + " 23:59:59"; } // 客户 String CustomerID = ""; if (request.getParameter("CustomerID") != null) { CustomerID = request.getParameter("CustomerID"); } // 委托人 String MandatorID = ""; if (request.getParameter("MandatorID") != null) { MandatorID = request.getParameter("MandatorID"); } // 收款人 String ReceiverID = ""; if (request.getParameter("ReceiverID") != null) { ReceiverID = request.getParameter("ReceiverID"); } String CurrencyID = ""; if (request.getParameter("CurrencyID") != null) { CurrencyID = request.getParameter("CurrencyID"); } String Status = ""; if (request.getParameter("Status") != null) { Status = request.getParameter("Status"); } String SendStatus = ""; if (request.getParameter("SendStatus") != null) { SendStatus = request.getParameter("SendStatus"); } // 获得当前登录用户设置的每页显示行数 String UserID = GlobalFunc.getUserID(request); int pageRows = Integer.parseInt(GlobalFunc.getUserPerPageNum(request)); // 根据查询条件获得需要显示的数据总量 int totalRows = payMoneyManager.getPayTotalCount( strMinTime, strMaxTime, ReceiverID, MandatorID, CustomerID, CurrencyID, Status, SendStatus); // 根据数据总量和每页显示行数得到需要显示的总页数 int totalPage = PageManager.getTotalPages(totalRows, pageRows); // 获得符合条件的某一页的数据 ArrayList Temp_List = payMoneyManager.getPayMoneyList( page, pageRows, strMinTime, strMaxTime, ReceiverID, MandatorID, CustomerID, CurrencyID, Status, SendStatus); // 获得符合条件的付汇金额占总的包干费的占比 String payRate = "0.0%"; if (strMinTime.length() > 0) { payRate = payMoneyManager.getPayRate(CustomerID, CurrencyID, strMinTime, strMaxTime); } request.setAttribute(Constant.PARA_LIST, Temp_List); request.setAttribute("minTime", minTime); request.setAttribute("maxTime", maxTime); request.setAttribute("BorderHeight", GlobalFunc.getBorderHeight(request)); request.setAttribute("ReceiverID", ReceiverID); request.setAttribute("CustomerID", CustomerID); request.setAttribute("MandatorID", MandatorID); request.setAttribute("CurrencyID", CurrencyID); request.setAttribute("Status", Status); request.setAttribute("SendStatus", SendStatus); request.setAttribute("payRate", payRate); request.setAttribute(Constant.PARA_CURPAGE, page); request.setAttribute(Constant.PARA_TOTALROWS, totalRows); request.setAttribute(Constant.PARA_TOTALPAGE, totalPage); // 为查询下拉列表做准备 // 获得所有收款人信息 request.setAttribute( "ReceiverList", PageManager.getLimitData( "BJPayee", "ID,PayeeName as ReceiverName", "Status!=-1 order by PayeeName")); // 获得所有委托人信息 request.setAttribute( "MandatorList", PageManager.getLimitData( "BeiJingClient", "ID,ShortName", "Status!=-1 order by ShortName")); // 获得所有结算客户信息 request.setAttribute( "CustomerList", PageManager.getLimitData( "BeiJingCustomer", "ID,ShortName", "Status!=-1 order by ShortName")); // 获得所有币种信息 request.setAttribute( "CurrencyList", PageManager.getLimitData("Currency", "ID,Currency", "Status!=-1 order by Currency")); } catch (Exception e) { request.setAttribute(Constant.ERROR_EXCEPTION, e); resultPage = Constant.ERROR_JSP; } return resultPage; }