/** * 根据处理状态查询计费信息 * * @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; }
/** * 根据查询条件分页查询出符合条件的商品订单信息 * * @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; }
/** * 根据订单商品信息中间表Id查询的商品订单信息(后台) * * @author 左香勇 2014-9-15 * @update * @param consumerOrderGoodsinfoDataId 订单商品信息中间表id * @return ConsumerOrderGoodsinfoData 订单商品信息中间实体 * @since vmaque 1.5 */ public ConsumerOrderGoodsinfoData getConSumerOrderGoodsInfoDataById( String consumerOrderGoodsinfoDataId) { // 定义查询语句 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,"); querySql.append("MCO.CREATETIME AS CREATETIME,MCO.LOGISTICSCOMPANY AS LOGISTICSCOMPANY,"); querySql.append("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("MPE.DOMAIN AS DOMAIN,MPG.NAME AS PAGENAME,"); querySql.append("CSU.RECEIVABLEACCOUNT AS RECEIVABLEACCOUNT,CSU.ACCOUNTTYPE AS ACCOUNTTYPE,"); querySql.append("CSU.LOGINMAIL AS LOGINMAIL,CSU.LOGINMOBLE AS LOGINMOBLE "); 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 MPG ON MCO.PAGEID=MPG.ID "); querySql.append("JOIN CTN_SYSUSER CSU ON MPG.USER_ID=CSU.ID "); querySql.append("RIGHT JOIN MINI_PAGE_INFO_EXTRA MPE ON MPG.ID=MPE.PAGE_ID "); querySql.append("WHERE MCG.ISDELETE = 1 AND MCO.ISDELETE = 1 "); querySql.append("AND MCC.ISDELETE = 1 AND MGI.ISDELETE = 1 AND MCU.ISDELETE = 1 "); querySql.append("AND MCG.ID = ?"); JdbcDao jdbcDao = (JdbcDao) SpringContextHelper.getBean("jdbc"); // 获取jdbc List<ETIPResultSet> rsList = jdbcDao.queryForList(querySql.toString(), new Object[] {consumerOrderGoodsinfoDataId}); if (rsList.size() > 0) { ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData = new ConsumerOrderGoodsinfoData(); ConSumerOrderData sumerOrderData = new ConSumerOrderData(); GoodsInfoData goodsInfoData = new GoodsInfoData(); CommodityConfigData commodityConfigData = new CommodityConfigData(); ConSumerUserData conSumerUserData = new ConSumerUserData(); PageData pageData = new PageData(); PageInfoExtraData pageInfoExtraData = new PageInfoExtraData(); UserData userData = new UserData(); // 给登录用户表添加数据 userData.setAccountType(rsList.get(0).getInt("ACCOUNTTYPE")); userData.setReceivableAccount(rsList.get(0).getString("RECEIVABLEACCOUNT")); userData.setLoginMail(rsList.get(0).getString("LOGINMAIL")); userData.setLoginMoble(rsList.get(0).getString("LOGINMOBLE")); // 给Page信息表添加数据 pageInfoExtraData.setDomain(rsList.get(0).getString("DOMAIN")); // 给page表添加数据 pageData.setName(rsList.get(0).getString("PAGENAME")); pageData.setUserData(userData); pageData.setPageInfoExtra(pageInfoExtraData); // 给订单用户信息表添加数据 conSumerUserData.setUserName(rsList.get(0).getString("USERNAME")); conSumerUserData.setUserAddress(rsList.get(0).getString("USERADDRESS")); conSumerUserData.setUserMobile(rsList.get(0).getString("USERMOBILE")); // 给订单表添加数据 sumerOrderData.setConSumerUserData(conSumerUserData); sumerOrderData.setPageData(pageData); sumerOrderData.setId(rsList.get(0).getString("CONSUMERORDERID")); sumerOrderData.setCreateTime(rsList.get(0).getDate("CREATETIME")); sumerOrderData.setPrice(rsList.get(0).getDouble("PRICE")); sumerOrderData.setState(rsList.get(0).getInt("STATE")); sumerOrderData.setLogisticsCompany(rsList.get(0).getString("LOGISTICSCOMPANY")); sumerOrderData.setLogisticsNumber(rsList.get(0).getString("LOGISTICSNUMBER")); sumerOrderData.setDeliverTime(rsList.get(0).getDate("DELIVERTIME")); // 给规格表添加数据 commodityConfigData.setConfigName(rsList.get(0).getString("CONFIGNAME")); // 给商品表添加数据 goodsInfoData.setGoodsName(rsList.get(0).getString("GOODSNAME")); // 给订单商品中间表添加数据 consumerOrderGoodsinfoData.setCommodityConfigData(commodityConfigData); consumerOrderGoodsinfoData.setGoodsInfoData(goodsInfoData); consumerOrderGoodsinfoData.setConSumerOrderData(sumerOrderData); consumerOrderGoodsinfoData.setGoodsNum(rsList.get(0).getInt("GOODSNUM")); consumerOrderGoodsinfoData.setId(rsList.get(0).getString("ID")); return consumerOrderGoodsinfoData; } return null; }