Easyui+MongoDB充值记录查询

Easyui+MongoDB充值记录查询

充值頁面的效果圖:
在这里插入图片描述
1.easyui頁面:

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title></title>

</head>

<body>
<table class="easyui-datagrid"  id="userList" class="easyui-datagrid" style="width: 1288px;height:420px;" title="充值记录"-->
    <thead>
    <tr>
      <th data-options="field:'id'">id</th>
      <th data-options="field:'appId'">appId</th>
      <th data-options="field:'openId'">openId</th>
      <th data-options="field:'mchId'">mchId</th>
        <th data-options="field:'paySuccess'">paySuccess</th>
        <th data-options="field:'createTime'">createTime</th>
        <th data-options="field:'outTradeNo'">outTradeNo</th>
        <th data-options="field:'totalFee'">totalFee</th>
        <th data-options="field:'cashFee'">cashFee</th>
        <th data-options="field:'rechargeToWallet'">rechargeToWallet</th>
    </tr>
    </thead>
    <tbody>
    <g:each in="${ret}"  status="i" var="${data}">
        <tr>
            <td>${data.id}</td>
            <td>${data.appId}</td>
            <td>${data.openId}</td>
            <td>${data.mchId}</td>
            <td>${data.paySuccess}</td>
            <td>${data.createTime}</td>
            <td>${data.outTradeNo}</td>
            <td>${data.totalFee}</td>
            <td>${data.cashFee}</td>
            <td>${data.rechargeToWallet}</td>
        </tr>
    </g:each>
    </tbody>
</table>
</body>
</html>

2.緩存MonGoDb數據記錄

/**
     * 将充值成功的记录保存到 mongo中
     * @param orderInfo
     */
    def saveMongoDbPayOrder(WxPayOrder order){
        String IPADDRESS = "mongodb://39.108.121.200:27017"
        try{
            MongoClient client = new MongoClient("localhost" , 27017);
            MongoDatabase database = client.getDatabase("cloudDB");
            MongoCollection<Document> collection = database.getCollection("ACCESS_LOG");
            Document document = new Document()
            document.append("id", order.id)
            document.append("appId", order.appId)
            document.append("openId", order.openId)
            document.append("mchId", order.mchId)
            document.append("feeType", order.feeType)
            document.append("transactionId", order.transactionId)//微信订单号,微信返回
            document.append("outTradeNo", order.outTradeNo)//商户订单号,商户自定义
            document.append("totalFee", order.totalFee)//订单总金额,单位为分
            document.append("cashFee", order.cashFee)
            document.append("timeEnd", order.timeEnd)
            document.append("paySuccess", order.paySuccess)//支付成功 0=未成功 1=成功
            document.append("refundFee", order.refundFee)//已退款的金额,单位为分
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            document.append("createTime",  sdf.format(order.createTime))
            document.append("rechargeToWallet", order.rechargeToyWallet)
            List<Document> documents = new ArrayList<Document>();
            documents.add(document);
            collection.insertMany(documents);//添加到mondoDb

            FindIterable<Document> findIterable = collection.find();
            MongoCursor<Document> mongoCursor = findIterable.iterator();
            while(mongoCursor.hasNext()){
                println mongoCursor.next()
            }

        }catch (Exception e){
            e.printStackTrace()
        }
        return null
    }

3.获取ret数据的的controller

 def payOrderMessage(){
        def ret = dianMiMiBackService.getOrderMessage()
        [ret: ret]
    }

4.service

def getOrderMessage(){
        def ret=[]
        try{
            MongoClient client = new MongoClient("localhost" , 27017);
            MongoDatabase database = client.getDatabase("cloudDB");
            MongoCollection<Document> collection = database.getCollection("ACCESS_LOG");
            FindIterable<Document> findIterable = collection.find();
            MongoCursor<Document> mongoCursor = findIterable.iterator();
            while(mongoCursor.hasNext()){
                Document a = mongoCursor.next();
                ret.add(a)
            }
            return  ret
        }catch (Exception e){
            e.printStackTrace()
        }

    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值