/** * 根据处理状态查询计费信息 * * @author 左香勇 2014-9-25 * @update * @param state 处理状态 pageRoll 分页查询对象 * @return List<ConsumerOrderGoodsinfoData> 计费信息 * @since vmaque 1.5 */ public List<ConsumerOrderGoodsinfoData> getAccountList(PageRoll pageRoll, Integer state) { // 定义查询语句 StringBuffer querySql = new StringBuffer("select * from(SELECT "); querySql.append("MCG.ID AS ID,"); querySql.append("MCO.PAYTYPE AS PAYTYPE,MCO.PRICE AS PRICE,"); querySql.append("MCO.STATE AS STATE,MCO.PAYTIME AS PAYTIME,"); querySql.append("MCO.ID AS MCOID,MCO.TRANSFERTIME AS TRANSFERTIME,"); querySql.append("MCO.TRANSFERPRICE AS TRANSFERPRICE,"); querySql.append("MCO.TRANSFERPEOPLE AS TRANSFERPEOPLE,"); querySql.append("ac.receivableaccount AS RECEIVABLEACCOUNT, "); querySql.append("ac.accounttype as acctype "); querySql.append("FROM MINI_CONSUMERORDER_GOODSINFO MCG "); querySql.append("JOIN MINI_CONSUMERORDER MCO ON MCG.CONSUMERORDERID = MCO.ID "); querySql.append("JOIN MINI_PAGE MPG ON MCO.PAGEID = MPG.ID "); querySql.append("JOIN CTN_SYSUSER CSU ON MPG.USER_ID = CSU.ID "); querySql.append("join MINI_ACCOUNTNUMBER ac on ac.userid=csu.id "); querySql.append("WHERE MCO.STATE = ? ) "); querySql.append("where PAYTYPE=acctype"); List<Object> objects = new ArrayList<Object>(); objects.add(state); // 分页查询 pageRoll.setCountSQL("SELECT COUNT(1) FROM (" + querySql.toString() + ")"); pageRoll.setSearchSQL(querySql.toString()); JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc List<ETIPResultSet> rsList = jdbcDao.search(pageRoll, objects); List<ConsumerOrderGoodsinfoData> consumerOrderGoodsinfoDatas = new ArrayList<ConsumerOrderGoodsinfoData>(); for (int i = 0; i < rsList.size(); i++) { ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData = new ConsumerOrderGoodsinfoData(); ConSumerOrderData sumerOrderData = new ConSumerOrderData(); UserData userData = new UserData(); PageData pageData = new PageData(); userData.setReceivableAccount(rsList.get(i).getString("RECEIVABLEACCOUNT")); pageData.setUserData(userData); sumerOrderData.setPageData(pageData); sumerOrderData.setId(rsList.get(i).getString("MCOID")); sumerOrderData.setPrice(rsList.get(i).getDouble("PRICE")); sumerOrderData.setState(rsList.get(i).getInt("STATE")); sumerOrderData.setPayType(rsList.get(i).getInt("PAYTYPE")); sumerOrderData.setPayTime(rsList.get(i).getDate("PAYTIME")); sumerOrderData.setTransferPeople(rsList.get(i).getString("TRANSFERPEOPLE")); sumerOrderData.setTransferPrice(rsList.get(i).getDouble("TRANSFERPRICE")); sumerOrderData.setTransferTime(rsList.get(i).getDate("TRANSFERTIME")); consumerOrderGoodsinfoData.setConSumerOrderData(sumerOrderData); consumerOrderGoodsinfoData.setId(rsList.get(i).getString("ID")); consumerOrderGoodsinfoDatas.add(consumerOrderGoodsinfoData); } return consumerOrderGoodsinfoDatas; }
public List searchProcessInstances(PageRoll pageRoll, ProcessInstanceData data) { // TODO Auto-generated method stub // 未完待续 pageRoll.setSearchSQL("from ProcessInstanceData"); pageRoll.setCountSQL("select count(*) from ProcessInstanceData"); return processInstancePersistence.search(pageRoll); }
/** * 微信接口查询商品订单数据信息(只提供给微信使用) * * @author 左香勇 2014年12月8日 * @update * @param state 订单状态 pageRoll 分页查询对象 * @return String 符合查询条件商品订单信息json字符串 * @see OrderManagerPersistence#queryGoodsOrder(PageRoll, int, String) * @since vmaque2.0 */ public String queryGoodsOrder(PageRoll pageRoll, int state, String openId) { StringBuffer querySql = new StringBuffer( "select distinct ida,ordercode,state,price,createtime,goodsname,configname from ("); querySql.append( " select conorder.id as ida,conorder.ordercode as ordercode," + "conorder.state as state,conorder.price as price,conorder.createtime as createtime," + "good.goodsname as goodsname,comm.configname as configname"); querySql.append( " from mini_consumeruser conuser,mini_consumerorder conorder,mini_consumerorder_goodsinfo congood," + "mini_goodsinfo good,mini_commodityconfig comm "); querySql.append( " where conuser.id = conorder.consumeruserid and conorder.id = congood.consumerorderid " + "and congood.commodityconfigid = comm.id and comm.goodsinfoid = good.id"); querySql.append( " and conorder.isdelete = 1 and congood.isdelete = 1 and conorder.weixinopenid = ? "); querySql.append(" union all"); querySql.append( " select conorder.id,conorder.ordercode,conorder.state,conorder.price,conorder.createtime as createtime," + "good.goodsname,comm.configname "); querySql.append( " from mini_consumeruser conuser,mini_consumerorder conorder,mini_consumerorder_goodsinfo congood," + "mini_goodsinfo good,mini_commodityconfig comm "); querySql.append( " where conuser.id = conorder.consumeruserid and conorder.id = congood.consumerorderid " + "and congood.commodityconfigid = comm.id and comm.goodsinfoid = good.id"); querySql.append( " and conorder.isdelete = 1 and congood.isdelete = 1 and conorder.consumeruserid in "); querySql.append( " (select conusernew.id from mini_consumeruser conusernew where conusernew.usermobile in "); querySql.append(" (select bind.phone from mini_bindwechatphone bind where bind.openid = ? )"); querySql.append(")"); querySql.append(")"); List<Object> objects = new ArrayList<Object>(); objects.add(openId); objects.add(openId); if (state != -1) { querySql.append(" where state = ?"); objects.add(state); } querySql.append(" order by createtime desc"); // 分页查询 pageRoll.setCountSQL("SELECT COUNT(1) FROM (" + querySql.toString() + ")"); pageRoll.setSearchSQL(querySql.toString()); JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc List<ETIPResultSet> rsList = jdbcDao.search(pageRoll, objects); JSONArray js = JSONArray.fromObject(rsList); return js.toString(); }
@SuppressWarnings("unchecked") public List<OrderData> getOrderDataList(PageRoll pageRoll, OrderData orderData) { // 定义条件查询的HQL语句 StringBuffer hql = new StringBuffer("from OrderData od where 1=1 "); List<Object> objectlist = new ArrayList<Object>(); StringBuffer sb = new StringBuffer(); // 用户查询 if (orderData.getSysUserId() != null && !"".equals(orderData.getSysUserId())) { sb.append(" and od.sysUserId = ?"); objectlist.add(orderData.getSysUserId()); } // 状态查询 if (orderData.getState() != null) { sb.append(" and od.state = ?"); objectlist.add(orderData.getState()); } else { // 默认查询 未付款的订单 sb.append(" and (od.state = 0 or od.state =1 )"); } sb.append(" order by od.createTime"); pageRoll.setCountSQL("select count(*) " + hql + sb.toString()); pageRoll.setSearchSQL(hql + sb.toString()); List<OrderData> list = orderProductPersistence.search(pageRoll, objectlist).getList(); List<OrderData> orderdList = new ArrayList<OrderData>(); if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { OrderData data = new OrderData(); data = list.get(i); // 订单实体 // 查询订单服务集合 if (data.getId() != null && !"".equals(data.getId())) { List<OrderProductData> orderProductDatas = new ArrayList<OrderProductData>(); orderProductDatas = orderProductPersistence.getOrderProductList(data); data.setOrderProductDatas(orderProductDatas); data.setProductNum(orderProductDatas.size()); } orderdList.add(data); } } return orderdList; }
/** * 查询工作流模板。 通过condition拼出查询条件,利用pageRoll进行分页查询 * * @param pageRoll 分页状态容器 * @param condition 查询条件容器 */ public List<ProcessInstanceData> search(PageRoll pageRoll, JSONObject condition) { // 首先根据condition拼出where语句 String processName = condition.getString("processName"); String processURL = condition.getString("processURL"); String where = " where 1>0"; if (processName != null && processName.trim().length() > 0) { where = where + " and processName like '%" + processName + "%'"; } if (processURL != null && processURL.trim().length() > 0) { where = where + " and processURL like '%" + processURL + "%'"; } String countSQL = "select count(*) from ProcessData" + where; String selectSQL = "from ProcessInstanceData " + where; pageRoll.setCountSQL(countSQL); pageRoll.setSearchSQL(selectSQL); List<ProcessInstanceData> processList = processInstancePersistence.search(pageRoll); // 最后查询返回值 return processList; }
/** * 根据查询条件分页查询出符合条件的商品订单信息 * * @author 左香勇 2014-9-9 * @update * @param conSumerOrderData 查询条件实体信息 pageRoll 分页查询对象 * @return List<ConsumerOrderGoodsinfoData> 符合查询条件商品订单信息集合 * @since vmaque 1.5 */ public List<ConsumerOrderGoodsinfoData> getConSumerOrderGoodsInfoDataList( PageRoll pageRoll, ConSumerOrderData conSumerOrderData) { // 定义查询语句 StringBuffer querySql = new StringBuffer("SELECT "); querySql.append("MCG.ID AS ID,MCG.GOODSNUM AS GOODSNUM,"); querySql.append( "MCO.ID AS CONSUMERORDERID,MCO.PRICE AS PRICE,MCO.STATE AS STATE,MCO.CREATETIME AS CREATETIME,MCO.LOGISTICSCOMPANY AS LOGISTICSCOMPANY,MCO.LOGISTICSNUMBER AS LOGISTICSNUMBER,MCO.DELIVERTIME AS DELIVERTIME,"); querySql.append("MCC.CONFIGNAME AS CONFIGNAME,"); querySql.append("MGI.GOODSNAME AS GOODSNAME,"); querySql.append( "MCU.USERNAME AS USERNAME,MCU.USERADDRESS AS USERADDRESS,MCU.USERMOBILE AS USERMOBILE "); querySql.append("FROM MINI_CONSUMERORDER_GOODSINFO MCG "); querySql.append("JOIN MINI_CONSUMERORDER MCO ON MCG.CONSUMERORDERID = MCO.ID "); querySql.append("JOIN MINI_COMMODITYCONFIG MCC ON MCG.COMMODITYCONFIGID = MCC.ID "); querySql.append("JOIN MINI_GOODSINFO MGI ON MCG.GOODSINFID = MGI.ID "); querySql.append("JOIN MINI_CONSUMERUSER MCU ON MCO.CONSUMERUSERID = MCU.ID "); querySql.append("JOIN MINI_PAGE_GOODSINFO MPG ON MPG.PAGEID = MCO.PAGEID "); querySql.append( "WHERE MCG.ISDELETE = 1 AND MCO.ISDELETE = 1 AND MCC.ISDELETE = 1 AND MGI.ISDELETE = 1 AND MCU.ISDELETE = 1 AND MCO.STATE <> 4 "); // 定义查询条件 StringBuffer where = new StringBuffer(""); List<Object> objects = new ArrayList<Object>(); // 添加查询条件 if (conSumerOrderData != null) { if (conSumerOrderData.getState() != null) { where.append(" AND MCO.STATE=?"); objects.add(conSumerOrderData.getState()); } if (conSumerOrderData.getPageId() != null && !conSumerOrderData.getPageId().equals("")) { where.append("AND MCO.PAGEID=? "); objects.add(conSumerOrderData.getPageId()); } querySql.append(where.toString()); } if (conSumerOrderData.getState() != null) { querySql.append("ORDER BY MCO.CREATETIME,MCO.PAYTYPE DESC"); } else { querySql.append("ORDER BY MCO.CREATETIME DESC"); } // 分页查询 pageRoll.setCountSQL("SELECT COUNT(1) FROM (" + querySql.toString() + ")"); pageRoll.setSearchSQL(querySql.toString()); JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc List<ETIPResultSet> rsList = jdbcDao.search(pageRoll, objects); List<ConsumerOrderGoodsinfoData> consumerOrderGoodsinfoDatas = new ArrayList<ConsumerOrderGoodsinfoData>(); for (int i = 0; i < rsList.size(); i++) { ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData = new ConsumerOrderGoodsinfoData(); ConSumerOrderData sumerOrderData = new ConSumerOrderData(); GoodsInfoData goodsInfoData = new GoodsInfoData(); CommodityConfigData commodityConfigData = new CommodityConfigData(); ConSumerUserData conSumerUserData = new ConSumerUserData(); conSumerUserData.setUserName(rsList.get(i).getString("USERNAME")); conSumerUserData.setUserAddress(rsList.get(i).getString("USERADDRESS")); conSumerUserData.setUserMobile(rsList.get(i).getString("USERMOBILE")); sumerOrderData.setConSumerUserData(conSumerUserData); sumerOrderData.setId(rsList.get(i).getString("CONSUMERORDERID")); sumerOrderData.setCreateTime(rsList.get(i).getDate("CREATETIME")); sumerOrderData.setPrice(rsList.get(i).getDouble("PRICE")); sumerOrderData.setState(rsList.get(i).getInt("STATE")); sumerOrderData.setLogisticsCompany(rsList.get(i).getString("LOGISTICSCOMPANY")); sumerOrderData.setLogisticsNumber(rsList.get(i).getString("LOGISTICSNUMBER")); sumerOrderData.setDeliverTime(rsList.get(i).getDate("DELIVERTIME")); commodityConfigData.setConfigName(rsList.get(i).getString("CONFIGNAME")); goodsInfoData.setGoodsName(rsList.get(i).getString("GOODSNAME")); consumerOrderGoodsinfoData.setCommodityConfigData(commodityConfigData); consumerOrderGoodsinfoData.setGoodsInfoData(goodsInfoData); consumerOrderGoodsinfoData.setConSumerOrderData(sumerOrderData); consumerOrderGoodsinfoData.setGoodsNum(rsList.get(i).getInt("GOODSNUM")); consumerOrderGoodsinfoData.setId(rsList.get(i).getString("ID")); consumerOrderGoodsinfoDatas.add(consumerOrderGoodsinfoData); } return consumerOrderGoodsinfoDatas; }