超划算投资接口文档

2017-06-21  本文已影响0人  Cabigail

一,controller

1,tbl_user

#rest/user [post]
添加用户
body:{
    "loginname":"admin2",
      "password":"admin",
      "levelid":"zn", //不填默认vip级别:1级
      "qq":"1163727363",
      "tel":"15311494814",
      "capital":0, //可以不填
      "interest":1, //可以不填
      "status":0, //不填默认0:正常
      "pinvitecode":"1e435d8dae47437ba35efe55a53d8c3a" //可以不填
}
result:{
  "statusCode": "000000",
    "result": {
        "uuid": "ca418cead34644f7827c470a32f90066",
        "loginname": "admin2",
        "password": "admin",
        "createtime": "2017-06-30 00:18:00",
        "levelid": "zn",
        "qq": "1163727363",
        "tel": "15311494814",
        "tid": "1e435d8dae47437ba35efe55a53d8c3a",
        "pid": "1e435d8dae47437ba35efe55a53d8c3a",
        "invitecode": "ca418cead34644f7827c470a32f90066",
        "capital": 0,
        "interest": 0,
        "status": 0
    },
    "error": ""
}
#rest/user/register  [post]
注册用户
body:{
    "loginname":"admin2",
      "password":"admin",
      "qq":"1163727363",
      "tel":"15311494814",
      "pinvitecode":"1e435d8dae47437ba35efe55a53d8c3a" //可以不填
}
result:{
{
    "statusCode": "000000",
    "result": {
        "uuid": "5b1dbbbf2b244a9488545caba057ea03",
        "loginname": "admin2",
        "password": "admin",
        "createtime": "2017-06-30 00:29:12",
        "levelid": "zn",
        "qq": "1163727363",
        "tel": "15311494814",
        "tid": "1e435d8dae47437ba35efe55a53d8c3a",
        "pid": "1e435d8dae47437ba35efe55a53d8c3a",
        "invitecode": "5b1dbbbf2b244a9488545caba057ea03",
        "capital": 0,
        "interest": 0,
        "status": 0
    },
    "error": ""
}
}
#rest/user/{userid}  [put]
修改用户
body:{
      "loginname":"admin0",
      "password":"admin30",
      "levelid":"zn1",
      "qq":"1163727363",
      "tel":"15311494814",
      "capital":0,
      "interest":18,
      "status":0,
      "pinvitecode":"ca418cead34644f7827c470a32f90066"
}
result:{
    "statusCode": "000000",
    "result": "ok",
    "error": ""
}
#rest/user/password/{userid} [put]
修改密码
body:{
    oldpassword:'旧密码',
    newpassword:'新密码',
    repassword:'原始密码'
}
result:{
    "statusCode": "000000",
    "result": "ok",
    "error": ""
}
#rest/user/{userid}  [get]
查询一条
result:{
    "statusCode": "000000",
    "result": {
        "uuid": "43151c08679c4c57bbd017cc23a54946",
        "loginname": "admin0",
        "password": "admin30",
        "createtime": "2017-06-30 01:03:08",
        "levelid": "zn122",
        "qq": "1163727363",
        "tel": "15311494814",
        "tid": "43151c08679c4c57bbd017cc23a54946",
        "pid": "",
        "invitecode": "43151c08679c4c57bbd017cc23a54946",
        "capital": 0,
        "interest": 18,
        "status": 0
    },
    "error": ""
}
#rest/user/query/     [get]
查询多条
params:{
     loginname/{loginname}
     /levelid/{levelid}
     /status/{status}
     /qq/{qq}
     /tel/{tel}
     /begincreatetime/{begincreatetime}
     /endcreatetime/{endcreatetime}
     /orderby/{orderby}
}
result:{
    "statusCode": "000000",
    "result": [],
    "error": ""
}
#rest/user/limit/     [get]
查询多条,带分页
params:{
     loginname/{loginname}
     /levelid/{levelid}
     /status/{status}
     /qq/{qq}
     /tel/{tel}
     /begincreatetime/{begincreatetime}
     /endcreatetime/{endcreatetime}
     /startindex/{startindex}
     /pagesize/{pagesize}
     /orderby/{orderby}
}
result:{
    "statusCode": "000000",
    "result": {
        "datas": [
            {
                "uuid": "43151c08679c4c57bbd017cc23a54946",
                "loginname": "admin0",
                "password": "admin30",
                "createtime": "2017-06-30 01:03:08",
                "levelid": "zn122",
                "qq": "1163727363",
                "tel": "15311494814",
                "tid": "43151c08679c4c57bbd017cc23a54946",
                "pid": "",
                "invitecode": "43151c08679c4c57bbd017cc23a54946",
                "capital": 0,
                "interest": 18,
                "status": 0
            }
        ],
        "startIndex": 0,
        "pageSize": 5,
        "total": 1
    },
    "error": ""
}

2, tbl_product

#rest/product  [post]
添加产品
body:{
    "name":"产品22",
    "bonus":15,
    "price":100.2,
    "num":2,
    "introduction":"这是一个很好的产品",
    "status":"online"//(online,soldout)可以不填,默认为online
}
result:{
    "statusCode": "000000",
    "result": {
        "uuid": "ca8c76686d894ce78fa32a654a335873",
        "name": "产品22",
        "bonus": 15,
        "price": 100.2,
        "num": 2,
        "status": "online",
        "introduction": "这是一个很好的产品",
        "createtime": "2017-07-01 00:55:59"
    },
    "error": ""
}
#rest/product/{productid}  [put]
修改产品
body:{
    "name":"产品0",
    "bonus":15.2,
    "price":100,
    "num":2,
        "status":"soldout",
    "introduction":"这是一个很好的产品"
}
result:{
    "statusCode": "000000",
    "result": "ok",
    "error": ""
}
#rest/product/{productid}  [get]
查询一条
result:{
    "statusCode": "000000",
    "result": {
        "uuid": "38fdba8c071148c78a96484b9eeb9ac2",
        "name": "产品0",
        "bonus": 15.2,
        "price": 100,
        "num": 2,
        "status": "online",
        "introduction": "这是一个很好的产品",
        "createtime": "2017-06-30 22:11:33"
    },
    "error": ""
}
#rest/product/query
查询多条
params:{
     name/%E4%BA%A7%E5%93%81
     /minbonus/15
     /maxbonus/16.5
     /status/online
     /begincreatetime/{begincreatetime}
     /endcreatetime/{endcreatetime}
}
result:{
    "statusCode": "000000",
    "result": [
        {
            "uuid": "38fdba8c071148c78a96484b9eeb9ac2",
            "name": "产品0",
            "bonus": 15.2,
            "price": 100,
            "num": 2,
            "status": "online",
            "introduction": "这是一个很好的产品",
            "createtime": "2017-06-30 22:11:33"
        }
    ],
    "error": ""
}
#rest/product/limit [get]
查询多条,带分页
params:{
     name/%E4%BA%A7%E5%93%81
     /minbonus/15
     /maxbonus/16.5
     /status/online
     /begincreatetime/{begincreatetime}
     /endcreatetime/{endcreatetime}
     /startindex/{startindex}
     /pagesize/{pagesize}
     /orderby/{orderby}
}
result:{
    "statusCode": "000000",
    "result": {
        "datas": [],
        "startIndex": 0,
        "pageSize": 10,
        "total": 0
    },
    "error": ""
}

3, tbl_record

#rest/record/limit  [get]
查询流水,带分页
params:{
      /userid/{userid}
      /type/{type}  //in , out
      /begincreatetime/{begincreatetime}
      /endcreatetime/{endcreatetime}
       /startindex/{startindex}
     /pagesize/{pagesize}
}

4,tbl_interst

#rest/interst [get]
查询利率信息
result:{
    "statusCode": "000000",
    "result": {
        "uuid": "interst_uuid",
        "principalinterest": 10,
        "l1gradeinterest": 10,
        "l2gradeinterest": 0,
        "l3gradeinterest": 0
    },
    "error": ""
}
#rest/interst [put]
修改利率信息
body:{
        "principalinterest":0,
       "l1gradeinterest":12,
       "l2gradeinterest":13.68,
       "l3gradeinterest":0.01
}
result:{
    "statusCode": "000000",
    "result": "ok",
    "error": ""
}

5,tbl_level

#rest/level/query  [get]
查询级别
result:{
    "statusCode": "000000",
    "result": [
        {
            "uuid": "490d2bcf91ba4377b2041f63c272c675",
            "name": "蓝钻会员",
            "grade": 1,
            "createtime": "2017-07-01 18:18:09"
        },
        {
            "uuid": "72463950dfa2464a8103f360bca9fca2",
            "name": "橙钻会员",
            "grade": 4,
            "createtime": "2017-07-01 18:18:09"
        },
        {
            "uuid": "7b0acf2045034b0c9d815dddc9081a46",
            "name": "黄钻会员",
            "grade": 3,
            "createtime": "2017-07-01 18:18:09"
        },
        {
            "uuid": "7fc9cffa788d4d1cbe583c21666b7938",
            "name": "红钻会员",
            "grade": 2,
            "createtime": "2017-07-01 18:18:09"
        }
    ],
    "error": ""
}

6, tbl_myproduct

#rest/myproduct/limit  [get]
查询我的产品
params:{
    userid/{userid}
   /startindex/{startindex}
   /pagesize/{pagesize}
}
result:{
    "statusCode": "000000",
    "result": {
        "datas": [
            {
                "uuid": "490d2bcf91ba4277b2041f63c272c675",
                "name": "myproduct",
                "bonus": 10,
                "price": 20,
                "num": 0,
                "userid": "userid",
                "introduction": "aaa",
                "buytime": "2017-07-01 18:18:09"
            }
        ],
        "startIndex": 0,
        "pageSize": 10,
        "total": 1
    },
    "error": ""
}
#rest/myproduct/{myproductid}  [get]
查询一件产品
result:{
    "statusCode": "000000",
    "result": {
        "uuid": "490d2bcf91ba4277b2041f63c272c675",
        "name": "myproduct",
        "bonus": 10,
        "price": 20,
        "num": 0,
        "userid": "userid",
        "introduction": "aaa",
        "buytime": "2017-07-01 18:18:09"
    },
    "error": ""
}

二 ,servlet

#servlet/productpurchasing 
购买产品Servlet
body:{
    "userid":"46077cd237184e56b4140008a34056c9",
    "productid":"8eafd51b608f4094b6dfd2bd496e98c4",
    "buynum":17
}
result:{
    "error": "",
    "result": "ok",
    "statusCode": "000000"
}
error1:{
    "error": "this product status is soldout , can not purchase",
    "result": "",
    "statusCode": "103007"
}
error2:{
    "error": " buynum over product num",
    "result": "",
    "statusCode": "103006"
}
#servlet/myproductsold
出售产品
body:{
      "myproductid":"38cf416bd3c04a559ff3d43c060b7eb2",
      "soldnum":15
}
result:{
    "error": "",
    "result": "ok",
    "statusCode": "000000"
}
error1:{
    "error": "sold num over my produt num",
    "result": "",
    "statusCode": "103006"
}
error2:{
    "error": " no my product data by this myproductid",
    "result": "",
    "statusCode": "103005"
}
#servlet/record  
记录流水
body:{
    "userid":"1c639a6927a74b998baf32b79ea60664", //用户id
    "money":20, //金额,需为正
    "type":"income", //类型,(income:收入,expense:支出)
    "remark":"账户充值" //备注(系统操作,利息收入,账户充值,账户提现)
}
#servlet/company
查询我的会员
body:{
    "userid":"586f250aa4324b6d99cf588be92f69e5", //用户id
    "loginname":"grage1",//账户,可不填,支持模糊搜索
    "grade":"0" //会员级别(同级:0,子一级:1,子二级:2,子三级:3)
}
result:{
    "error": "",
    "result": {
        "datas": [
            {
                "uuid": "c9edc2a065d246de8eb15b449b5d5fe3",
                "loginname": "grage1",
                "password": "admin",
                "createtime": "2017-07-02 21:16:04",
                "levelid": "490d2bcf91ba4377b2041f63c272c675",
                "qq": "1163727363",
                "tel": "15311494814",
                "tid": "46077cd237184e56b4140008a34056c9",
                "pid": "46077cd237184e56b4140008a34056c9",
                "invitecode": "c9edc2a065d246de8eb15b449b5d5fe3",
                "capital": 0,
                "interest": 0,
                "status": 0
            }
        ],
        "pageSize": 10,
        "startIndex": 0,
        "total": 1
    },
    "statusCode": "000000"
}
#servlet/login
登陆用户
body:{
    "loginname":"main",
    "password":"admin30"
}
result:{
    "error": "",
    "result": {
        "uuid": "46077cd237184e56b4140008a34056c9",
        "loginname": "main",
        "password": "admin30",
        "createtime": "2017-07-01 22:19:42",
        "levelid": "72463950dfa2464a8103f360bca9fca2",
        "qq": "1163727363",
        "tel": "15311494814",
        "tid": "46077cd237184e56b4140008a34056c9",
        "pid": "",
        "invitecode": "46077cd237184e56b4140008a34056c9",
        "capital": 20.4,
        "interest": 0,
        "status": 0
    },
    "statusCode": "000000"
}
error:{
    "error": " no user data by this loginname and password",
    "result": "",
    "statusCode": "103005"
}

三,manage

#UserManage
1,updatePassword:
    /**
     * 验证原始密码是否正确,新密码和确认密码是否一致,并修改为新密码
     * @param jsonMap 原始密码,新密码,验证新密码
     * @param userid 用户id
     * @throws Exception
     */
2,validateUserAndProductAndNum:
    /**
     * 验证用户是否存在,产品是否存在,产品是否可以购买,产品数量是否足够购买,用户本金是否足够
     * @param userid 用户id
     * @param productid 产品id
     * @param buynum 购买数量
     * @throws Exception
     */
3,minusUserCapital:
    /**
     * 减去用户本金金额
     * @param userid 用户id
     * @param minuscapital 减去的本金
     */
#ProductManage
1,soldoutById:
    /**
     * 下架产品
     * @param uuid 产品id
     * @throws SQLException
     */
#MyproductManage:
1,buyProduct:
    /**
     * 购买产品,加入到我的产品中,并减去产品数量,当产品剩余数量为0时,下架该产品,并更新用户本金
     * @param userid 用户id
     * @param productid 产品id
     * @param buynum 购买数量
     * @throws SQLException
     */
2,minusProductNum:
    /**
     * 减去产品数量,当产品数量为0,下架该产品
     * @param product 产品实例
     * @param buynum 购买数量
     * @throws SQLException
     */
3,addMyProduct:
    /**
     * 购买产品到我的购买产品列表中
     * @param userid 用户id
     * @param product 购买的产品实例
     * @param buynum 购买数量
     * @return
     * @throws SQLException
     */
4,validateMyProduct:
    /**
     * 验证我的产品是否存在和出售数量是否足够
     * @param myproductid 我购买的产品id
     * @param soldnum 卖出数量
     */
5,soldMyproduct:
    /**
     * 卖出我的产品,减去卖出的数量,当剩余数量为0时,删除此条产品信息,并更新用户本金
     * @param myproductid
     * @param soldnum
     */
6,minusUserCapital:
    /**
     * 减去用户购买产品的金额
     * @param product 产品实例
     * @param userid 用户id
     * @param buynum 购买数量
     */
7,addUserCapital:
    /**
     * 增加用户本金金额
     * @param userid 用户id
     * @param addcapital 增加的金额
     * @throws SQLException
     */
#RecordManage:
1,addUserRecord:
    /**
     * 添加流水记录
     * @param userid 用户id
     * @param money 金额,可正可负
     * @param remark 备注 (系统操作,利息收入,账户充值,账户提现)
     * @param type 流水类型(income,expense)
     */
#CompanyManage:
1,selectMyCompany
    /**
     * 查询我的会员(同级,子一级,子二级,子三级)
     * @param userid 用户id
     * @param grade  会员级别(同级:0,子一级:1,子二级:2,子三级:3)
     * @return bloackData
     * @throws SQLException
     */
2,selectCompany_0
    /**
     * 查询我的同级会员
     * @param userid 用户id
     * @param pid 上级id
     * @param tid 顶级id
     * @param startindex
     * @param pagesize
     * @return
     */
3,selectCompany_1
    /**
     * 查询我的子一级会员
     * @param userid 用户id
     * @param startindex
     * @param pagesize
     * @return
     */
4,selectCompany_2
    /**
     * 查询我的子二级会员
     * @param userid 用户id
     * @param startindex
     * @param pagesize
     * @return
     */
5,selectCompany_3
    /**
     * 查询我的子三级会员
     * @param userid 用户id
     * @param startindex
     * @param pagesize
     * @return
     */
#InterstManage
1clearIntersts
    /**
     * 结算每日利息
     * @return
     */
2,changeIntersts
    /**
     * 将利息充入本金
     * @return
     */
3,clearInterstsByCapital
    /**
     * 清算本金利息
     */
4,clearInterstsByDividends
    /**
     * 清算分红信息
     * @return boolean
     */
5,selectInterstCompany_1
    /**
     * 查询用户一级会员利息
     * @param uuid
     * @return double
     */
6,selectInterstCompany_2
    /**
     * 查询用户二级会员利息
     * @param uuid
     * @return double
     */
7,selectInterstCompany_3
    /**
     * 查询三级会员利息
     * @param uuid
     * @return double
     */
#LevelManage
1,getGrage1LevelId
    /**
     * 获取级别中一级级别的UUID
     * @return String
     */
#RecordManage
1,addUserRecord
    /**
     * 添加流水记录
     * @param userid 用户id
     * @param money 金额,可正可负
     * @param remark 备注 (系统操作,利息收入,账户充值,账户提现)
     * @param type 流水类型(income,expense)
     */
上一篇下一篇

猜你喜欢

热点阅读