Parcourir la source

增加“资金流水查询(当前)”接口

Simon Zhou il y a 5 ans
Parent
commit
d89ab77f49

+ 113 - 0
controllers/taaccount/taaccount.go

@@ -0,0 +1,113 @@
+package taaccount
+
+import (
+	"fmt"
+	"mtp2_if/db"
+	"mtp2_if/global/app"
+	"mtp2_if/global/e"
+	"mtp2_if/logger"
+	"mtp2_if/models"
+	"net/http"
+
+	"github.com/gin-gonic/gin"
+)
+
+// QueryAmountLogReq 资金流水查询(当前)请求参数
+type QueryAmountLogReq struct {
+	app.PageInfo
+	AccountID   string `form:"accountID"`   // 资金账户
+	OperateType string `form:"operateType"` // 资金操作类型
+}
+
+// QueryAmountLogRsp 资金流水查询(当前)返回模型
+type QueryAmountLogRsp struct {
+	models.Taaccountlog `xorm:"extends"`
+
+	MarketName      string `json:"marketname"  xorm:"'MARKETNAME'"`        // 市场名称
+	TradeMode       uint32 `json:"trademode"  xorm:"'TRADEMODE'"`          // 交易模式
+	GoodsCode       string `json:"goodscode"  xorm:"'GOODSCODE'"`          // 商品代码
+	GoodsName       string `json:"goodsname"  xorm:"'GOODSNAME'"`          // 商品名称
+	AGoodsCode      string `json:"agoodscode"  xorm:"'AGOODSCODE'"`        // 竞拍商品代码
+	AGoodsName      string `json:"agoodsname"  xorm:"'GOODSNAME'"`         // 竞拍商品名称
+	DGoodsCode      string `json:"dgoodscode"  xorm:"'DGOODSCODE'"`        // 交割商品代码
+	DGoodsName      string `json:"dgoodsname"  xorm:"'DGOODSNAME'"`        // 交割商品名称
+	OperateTypeName string `json:"OPERATETYPENAME" xorm:"OPERATETYPENAME"` // 资金操作类型名称
+}
+
+// QueryAmountLog 资金流水查询(当前)
+// @Summary 资金流水查询(当前)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param page query int false "页码"
+// @Param pagesize query int false "每页条数"
+// @Param accountID query string true "资金账户 - 格式:1,2,3"
+// @Param OperateType query string false "资金操作类型 - 格式:1,2,3"
+// @Success 200 {object} QueryAmountLogRsp
+// @Failure 500 {object} app.Response
+// @Router /TaAccount/QueryAmountLog [get]
+// @Tags 资金账户
+// 参数通用查询:QueryClientAmountLog
+func QueryAmountLog(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryAmountLogReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryAmountLog failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 查询数据
+	datas := make([]QueryAmountLogRsp, 0)
+	engine := db.GetEngine()
+	s := engine.Table("TAACCOUNTLOG").
+		Join("LEFT", "ENUMDICITEM", "ENUMDICITEM.ENUMITEMSTATUS = 1 and ENUMDICITEM.ENUMDICID = 39 and ENUMDICITEM.ENUMITEMNAME = TAACCOUNTLOG.OPERATETYPE").
+		Join("LEFT", "MARKET", "MARKET.MARKETID = TAACCOUNTLOG.MARKETID").
+		Join("LEFT", "GOODS", "GOODS.GOODSID = TAACCOUNTLOG.GOODSID").
+		Join("LEFT", "AUCTION_ORDERINFO", "AUCTION_ORDERINFO.GOODSID = TAACCOUNTLOG.GOODSID").
+		Join("LEFT", "DELIVERYGOODS", "DELIVERYGOODS.DELIVERYGOODSID = TAACCOUNTLOG.GOODSID").
+		Select(`to_char(TAACCOUNTLOG.RELATIONORDERID) as RELATIONORDERID, TAACCOUNTLOG.*, 
+				MARKET.MARKETNAME, MARKET.TRADEMODE, 
+				GOODS.GOODSCODE, GOODS.GOODSNAME, 
+				AUCTION_ORDERINFO.GOODSCODE AS AGOODSCODE, AUCTION_ORDERINFO.GOODSNAME AS AGOODSNAME, 
+				DELIVERYGOODS.DELIVERYGOODSCODE AS DGOODSCODE, DELIVERYGOODS.DELIVERYGOODSNAME AS DGOODSNAME, 
+				ENUMDICITEM.ENUMDICNAME AS OPERATETYPENAME`).
+		Where(fmt.Sprintf("TAACCOUNTLOG.ACCOUNTID in (%s)", req.AccountID)).Desc("TAACCOUNTLOG.AUTOID")
+	if len(req.OperateType) > 0 {
+		s = s.And(fmt.Sprintf("TAACCOUNTLOG.OPERATETYPE in (%s)", req.OperateType))
+	}
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryAmountLog failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	if req.PageSize > 0 {
+		// 分页
+		rst := make([]QueryAmountLogRsp, 0)
+		// 开始上标
+		start := req.Page * req.PageSize
+		// 结束下标
+		end := start + req.PageSize
+
+		if start <= len(datas) {
+			// 判断结束下标是否越界
+			if end > len(datas) {
+				end = len(datas)
+			}
+			rst = datas[start:end]
+		} else {
+			rst = datas[0:0]
+		}
+
+		logger.GetLogger().Infof("QueryRecieptOrder successed: %v", rst)
+		appG.ResponseByPage(http.StatusOK, e.SUCCESS, rst, app.PageInfo{Page: req.Page, PageSize: req.PageSize, Total: len(datas)})
+	} else {
+		// 不分页
+		logger.GetLogger().Infof("QueryRecieptOrder successed: %v", datas)
+		appG.Response(http.StatusOK, e.SUCCESS, datas)
+	}
+}

+ 180 - 0
docs/docs.go

@@ -666,6 +666,18 @@ var doc = `{
                         "description": "成交类别 - 格式:1,2,3",
                         "name": "tradeType",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "开始时间 - 闭区间,格式:yyyy-MM-dd",
+                        "name": "startDate",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "结束时间 - 闭区间,格式:yyyy-MM-dd",
+                        "name": "endDate",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -1179,6 +1191,63 @@ var doc = `{
                 }
             }
         },
+        "/TaAccount/QueryAmountLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "资金账户"
+                ],
+                "summary": "资金流水查询(当前)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金操作类型 - 格式:1,2,3",
+                        "name": "OperateType",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/taaccount.QueryAmountLogRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/User/GetLoginID": {
             "get": {
                 "produces": [
@@ -4563,6 +4632,117 @@ var doc = `{
                     "type": "string"
                 }
             }
+        },
+        "taaccount.QueryAmountLogRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "amount",
+                "amountadjusttype",
+                "autoid",
+                "balance",
+                "createtime",
+                "currentbalance",
+                "operatetype"
+            ],
+            "properties": {
+                "OPERATETYPENAME": {
+                    "description": "资金操作类型名称",
+                    "type": "string"
+                },
+                "accountid": {
+                    "description": "资金账户ID",
+                    "type": "integer"
+                },
+                "agoodscode": {
+                    "description": "竞拍商品代码",
+                    "type": "string"
+                },
+                "agoodsname": {
+                    "description": "竞拍商品名称",
+                    "type": "string"
+                },
+                "amount": {
+                    "description": "资金金额",
+                    "type": "number"
+                },
+                "amountadjusttype": {
+                    "description": "资金调整类型(默认值为0) -  0:系统 1:单边账调整  2:人工调整",
+                    "type": "integer"
+                },
+                "autoid": {
+                    "description": "流水ID(220+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "balance": {
+                    "description": "期初余额",
+                    "type": "number"
+                },
+                "businesscode": {
+                    "description": "业务编号",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "发生时间",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种ID",
+                    "type": "integer"
+                },
+                "currentbalance": {
+                    "description": "期末余额(变动后金额)",
+                    "type": "number"
+                },
+                "dgoodscode": {
+                    "description": "交割商品代码",
+                    "type": "string"
+                },
+                "dgoodsname": {
+                    "description": "交割商品名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "moneyticket": {
+                    "description": "资金流水号:银行端流水号",
+                    "type": "integer"
+                },
+                "operatetype": {
+                    "description": "资金操作类型 (AccountFundCmdOp)- 101:入金 102:入金手续费 103:出金 104:出金冻结 105:出金解冻 106:出金手续费 107:出金手续费冻结 108:出金手续费解冻 201:交易冻结 202:交易解冻 203:交易占用 204:交易解占用 205:交易手续费冻结 206:交易手续费解冻 207:交易手续费 208:交易货款 209:交易盈亏 301:交割冻结 302:交割解冻 303:交割手续费 304:交割手续费冻结 305:交割手续费解冻 306:交割货款 307:交割税款 401:结算盈亏 402:结算递延费 403:分润收入 404:延期分润 501:授信增加 502:授信减少 503:转积分 504:转入 505:转出 506:转出冻结 507:转出解冻  601:履约金额冻结 602:履约最大冻结 603:履约金额解冻 604:履约扣款 605:履约收款 606:履约违约手续费 607:履约违约收入 608:履约最大扣款 701:供应链金融冻结 702:供应链金融解冻 703:供应链金融最大冻结 704:供应链金融利息 705:供应链金融货款 706:供应链金融押金 707:供应链金融最大扣款 801:仓单贸易冻结 802:仓单贸易解冻 803:仓单贸易首付款 804:仓单贸易最大扣款 901:商城扣款冻结 902:商城扣款解冻 903:商城扣款 904:商城收款 1001:期权冻结 1002:期权解冻 1003:期权权力金 1004:期权手续费冻结 1005:期权手续费解冻 1006:期权手续费 1007:期权盈亏 1101:营销扣款 1102:营销收款",
+                    "type": "integer"
+                },
+                "relationorderid": {
+                    "description": "关联单号",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "trademode": {
+                    "description": "交易模式",
+                    "type": "integer"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 180 - 0
docs/swagger.json

@@ -650,6 +650,18 @@
                         "description": "成交类别 - 格式:1,2,3",
                         "name": "tradeType",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "开始时间 - 闭区间,格式:yyyy-MM-dd",
+                        "name": "startDate",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "结束时间 - 闭区间,格式:yyyy-MM-dd",
+                        "name": "endDate",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -1163,6 +1175,63 @@
                 }
             }
         },
+        "/TaAccount/QueryAmountLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "资金账户"
+                ],
+                "summary": "资金流水查询(当前)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金操作类型 - 格式:1,2,3",
+                        "name": "OperateType",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/taaccount.QueryAmountLogRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/User/GetLoginID": {
             "get": {
                 "produces": [
@@ -4547,6 +4616,117 @@
                     "type": "string"
                 }
             }
+        },
+        "taaccount.QueryAmountLogRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "amount",
+                "amountadjusttype",
+                "autoid",
+                "balance",
+                "createtime",
+                "currentbalance",
+                "operatetype"
+            ],
+            "properties": {
+                "OPERATETYPENAME": {
+                    "description": "资金操作类型名称",
+                    "type": "string"
+                },
+                "accountid": {
+                    "description": "资金账户ID",
+                    "type": "integer"
+                },
+                "agoodscode": {
+                    "description": "竞拍商品代码",
+                    "type": "string"
+                },
+                "agoodsname": {
+                    "description": "竞拍商品名称",
+                    "type": "string"
+                },
+                "amount": {
+                    "description": "资金金额",
+                    "type": "number"
+                },
+                "amountadjusttype": {
+                    "description": "资金调整类型(默认值为0) -  0:系统 1:单边账调整  2:人工调整",
+                    "type": "integer"
+                },
+                "autoid": {
+                    "description": "流水ID(220+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "balance": {
+                    "description": "期初余额",
+                    "type": "number"
+                },
+                "businesscode": {
+                    "description": "业务编号",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "发生时间",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种ID",
+                    "type": "integer"
+                },
+                "currentbalance": {
+                    "description": "期末余额(变动后金额)",
+                    "type": "number"
+                },
+                "dgoodscode": {
+                    "description": "交割商品代码",
+                    "type": "string"
+                },
+                "dgoodsname": {
+                    "description": "交割商品名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "moneyticket": {
+                    "description": "资金流水号:银行端流水号",
+                    "type": "integer"
+                },
+                "operatetype": {
+                    "description": "资金操作类型 (AccountFundCmdOp)- 101:入金 102:入金手续费 103:出金 104:出金冻结 105:出金解冻 106:出金手续费 107:出金手续费冻结 108:出金手续费解冻 201:交易冻结 202:交易解冻 203:交易占用 204:交易解占用 205:交易手续费冻结 206:交易手续费解冻 207:交易手续费 208:交易货款 209:交易盈亏 301:交割冻结 302:交割解冻 303:交割手续费 304:交割手续费冻结 305:交割手续费解冻 306:交割货款 307:交割税款 401:结算盈亏 402:结算递延费 403:分润收入 404:延期分润 501:授信增加 502:授信减少 503:转积分 504:转入 505:转出 506:转出冻结 507:转出解冻  601:履约金额冻结 602:履约最大冻结 603:履约金额解冻 604:履约扣款 605:履约收款 606:履约违约手续费 607:履约违约收入 608:履约最大扣款 701:供应链金融冻结 702:供应链金融解冻 703:供应链金融最大冻结 704:供应链金融利息 705:供应链金融货款 706:供应链金融押金 707:供应链金融最大扣款 801:仓单贸易冻结 802:仓单贸易解冻 803:仓单贸易首付款 804:仓单贸易最大扣款 901:商城扣款冻结 902:商城扣款解冻 903:商城扣款 904:商城收款 1001:期权冻结 1002:期权解冻 1003:期权权力金 1004:期权手续费冻结 1005:期权手续费解冻 1006:期权手续费 1007:期权盈亏 1101:营销扣款 1102:营销收款",
+                    "type": "integer"
+                },
+                "relationorderid": {
+                    "description": "关联单号",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "trademode": {
+                    "description": "交易模式",
+                    "type": "integer"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 128 - 0
docs/swagger.yaml

@@ -2425,6 +2425,90 @@ definitions:
         description: 交易日(yyyyMMdd)
         type: string
     type: object
+  taaccount.QueryAmountLogRsp:
+    properties:
+      OPERATETYPENAME:
+        description: 资金操作类型名称
+        type: string
+      accountid:
+        description: 资金账户ID
+        type: integer
+      agoodscode:
+        description: 竞拍商品代码
+        type: string
+      agoodsname:
+        description: 竞拍商品名称
+        type: string
+      amount:
+        description: 资金金额
+        type: number
+      amountadjusttype:
+        description: 资金调整类型(默认值为0) -  0:系统 1:单边账调整  2:人工调整
+        type: integer
+      autoid:
+        description: 流水ID(220+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      balance:
+        description: 期初余额
+        type: number
+      businesscode:
+        description: 业务编号
+        type: integer
+      createtime:
+        description: 发生时间
+        type: string
+      currencyid:
+        description: 币种ID
+        type: integer
+      currentbalance:
+        description: 期末余额(变动后金额)
+        type: number
+      dgoodscode:
+        description: 交割商品代码
+        type: string
+      dgoodsname:
+        description: 交割商品名称
+        type: string
+      goodscode:
+        description: 商品代码
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      marketid:
+        description: 市场ID
+        type: integer
+      marketname:
+        description: 市场名称
+        type: string
+      moneyticket:
+        description: 资金流水号:银行端流水号
+        type: integer
+      operatetype:
+        description: 资金操作类型 (AccountFundCmdOp)- 101:入金 102:入金手续费 103:出金 104:出金冻结 105:出金解冻 106:出金手续费 107:出金手续费冻结 108:出金手续费解冻 201:交易冻结 202:交易解冻 203:交易占用 204:交易解占用 205:交易手续费冻结 206:交易手续费解冻 207:交易手续费 208:交易货款 209:交易盈亏 301:交割冻结 302:交割解冻 303:交割手续费 304:交割手续费冻结 305:交割手续费解冻 306:交割货款 307:交割税款 401:结算盈亏 402:结算递延费 403:分润收入 404:延期分润 501:授信增加 502:授信减少 503:转积分 504:转入 505:转出 506:转出冻结 507:转出解冻  601:履约金额冻结 602:履约最大冻结 603:履约金额解冻 604:履约扣款 605:履约收款 606:履约违约手续费 607:履约违约收入 608:履约最大扣款 701:供应链金融冻结 702:供应链金融解冻 703:供应链金融最大冻结 704:供应链金融利息 705:供应链金融货款 706:供应链金融押金 707:供应链金融最大扣款 801:仓单贸易冻结 802:仓单贸易解冻 803:仓单贸易首付款 804:仓单贸易最大扣款 901:商城扣款冻结 902:商城扣款解冻 903:商城扣款 904:商城收款 1001:期权冻结 1002:期权解冻 1003:期权权力金 1004:期权手续费冻结 1005:期权手续费解冻 1006:期权手续费 1007:期权盈亏 1101:营销扣款 1102:营销收款
+        type: integer
+      relationorderid:
+        description: 关联单号
+        type: string
+      remark:
+        description: 备注
+        type: string
+      trademode:
+        description: 交易模式
+        type: integer
+    required:
+    - accountid
+    - amount
+    - amountadjusttype
+    - autoid
+    - balance
+    - createtime
+    - currentbalance
+    - operatetype
+    type: object
 info:
   contact: {}
   description: 新的查询服务,替代原通用查询服务。
@@ -2829,6 +2913,14 @@ paths:
         in: query
         name: tradeType
         type: string
+      - description: 开始时间 - 闭区间,格式:yyyy-MM-dd
+        in: query
+        name: startDate
+        type: string
+      - description: 结束时间 - 闭区间,格式:yyyy-MM-dd
+        in: query
+        name: endDate
+        type: string
       produces:
       - application/json
       responses:
@@ -3157,6 +3249,42 @@ paths:
       summary: 搜索白名单
       tags:
       - 定制【尚志大宗】
+  /TaAccount/QueryAmountLog:
+    get:
+      parameters:
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      - description: 资金账户 - 格式:1,2,3
+        in: query
+        name: accountID
+        required: true
+        type: string
+      - description: 资金操作类型 - 格式:1,2,3
+        in: query
+        name: OperateType
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/taaccount.QueryAmountLogRsp'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 资金流水查询(当前)
+      tags:
+      - 资金账户
   /User/GetLoginID:
     get:
       parameters:

+ 22 - 0
global/app/response.go

@@ -39,3 +39,25 @@ func (g *Gin) ResponseByPage(httpCode, errCode int, data interface{}, page PageI
 	})
 	return
 }
+
+// GetPageData 获取指定分页的数据
+func GetPageData(datas []interface{}, pageInfo PageInfo) []interface{} {
+	// 开始上标
+	start := pageInfo.Page * pageInfo.PageSize
+	// 结束下标
+	// a := []int{1,2,3,4,5}
+	// a[2:4] -> [3 4]
+	end := start + pageInfo.PageSize
+
+	if start <= len(datas) {
+		// 判断结束下标是否越界
+		if end > len(datas) {
+			end = len(datas)
+		}
+		datas = datas[start:end]
+	} else {
+		datas = datas[0:0]
+	}
+
+	return datas
+}

+ 24 - 0
models/accountModels.go

@@ -269,3 +269,27 @@ type Arearole struct {
 func (Arearole) TableName() string {
 	return "AREAROLE"
 }
+
+// Taaccountlog 资金账户记账流水表 - 导历史
+type Taaccountlog struct {
+	Autoid           int64     `json:"autoid"  xorm:"'AUTOID'" binding:"required"`                     // 流水ID(220+Unix秒时间戳(10位)+xxxxxx)
+	Accountid        int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"`               // 资金账户ID
+	Relationorderid  string    `json:"relationorderid"  xorm:"'RELATIONORDERID'"`                      // 关联单号
+	Marketid         int32     `json:"marketid"  xorm:"'MARKETID'"`                                    // 市场ID
+	Goodsid          int32     `json:"goodsid"  xorm:"'GOODSID'"`                                      // 商品ID
+	Currencyid       int64     `json:"currencyid"  xorm:"'CURRENCYID'"`                                // 币种ID
+	Amount           float64   `json:"amount"  xorm:"'AMOUNT'" binding:"required"`                     // 资金金额
+	Amountadjusttype int32     `json:"amountadjusttype"  xorm:"'AMOUNTADJUSTTYPE'" binding:"required"` // 资金调整类型(默认值为0) -  0:系统 1:单边账调整  2:人工调整
+	Balance          float64   `json:"balance"  xorm:"'BALANCE'" binding:"required"`                   // 期初余额
+	Currentbalance   float64   `json:"currentbalance"  xorm:"'CURRENTBALANCE'" binding:"required"`     // 期末余额(变动后金额)
+	Createtime       time.Time `json:"createtime"  xorm:"'CREATETIME'" binding:"required"`             // 发生时间
+	Operatetype      int32     `json:"operatetype"  xorm:"'OPERATETYPE'" binding:"required"`           // 资金操作类型 (AccountFundCmdOp)- 101:入金 102:入金手续费 103:出金 104:出金冻结 105:出金解冻 106:出金手续费 107:出金手续费冻结 108:出金手续费解冻 201:交易冻结 202:交易解冻 203:交易占用 204:交易解占用 205:交易手续费冻结 206:交易手续费解冻 207:交易手续费 208:交易货款 209:交易盈亏 301:交割冻结 302:交割解冻 303:交割手续费 304:交割手续费冻结 305:交割手续费解冻 306:交割货款 307:交割税款 401:结算盈亏 402:结算递延费 403:分润收入 404:延期分润 501:授信增加 502:授信减少 503:转积分 504:转入 505:转出 506:转出冻结 507:转出解冻  601:履约金额冻结 602:履约最大冻结 603:履约金额解冻 604:履约扣款 605:履约收款 606:履约违约手续费 607:履约违约收入 608:履约最大扣款 701:供应链金融冻结 702:供应链金融解冻 703:供应链金融最大冻结 704:供应链金融利息 705:供应链金融货款 706:供应链金融押金 707:供应链金融最大扣款 801:仓单贸易冻结 802:仓单贸易解冻 803:仓单贸易首付款 804:仓单贸易最大扣款 901:商城扣款冻结 902:商城扣款解冻 903:商城扣款 904:商城收款 1001:期权冻结 1002:期权解冻 1003:期权权力金 1004:期权手续费冻结 1005:期权手续费解冻 1006:期权手续费 1007:期权盈亏 1101:营销扣款 1102:营销收款
+	Moneyticket      int64     `json:"moneyticket"  xorm:"'MONEYTICKET'"`                              // 资金流水号:银行端流水号
+	Remark           string    `json:"remark"  xorm:"'REMARK'"`                                        // 备注
+	Businesscode     int32     `json:"businesscode"  xorm:"'BUSINESSCODE'"`                            // 业务编号
+}
+
+// TableName is TAACCOUNTLOG
+func (Taaccountlog) TableName() string {
+	return "TAACCOUNTLOG"
+}

+ 82 - 0
models/actionModels.go

@@ -0,0 +1,82 @@
+package models
+
+import "time"
+
+// 竞拍模型
+
+// Auctionorderinfo 竞拍信息表 - 导历史
+type Auctionorderinfo struct {
+	Goodsid                 int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`              // 拍品ID - 自增 SEQ_GOODS 确保不重复
+	Goodscode               string    `json:"goodscode"  xorm:"'GOODSCODE'"`                             // 拍品代码 - 系统自动生成  [#A(2位) + GoodsID十六进制(6位) ]
+	Goodsname               string    `json:"goodsname"  xorm:"'GOODSNAME'"`                             // 拍品名称
+	Applyid                 int64     `json:"applyid"  xorm:"'APPLYID'"`                                 // 申请ID
+	Wruserid                int64     `json:"wruserid"  xorm:"'WRUSERID'"`                               // 申请人用户ID
+	Wraccountid             int64     `json:"wraccountid"  xorm:"'WRACCOUNTID'"`                         // 资金账号ID
+	Marketid                int32     `json:"marketid"  xorm:"'MARKETID'"`                               // 市场ID
+	Buyorsell               int32     `json:"buyorsell"  xorm:"'BUYORSELL'"`                             // 买卖 - 0:买 1:卖
+	Wrfactortypeid          int64     `json:"wrfactortypeid"  xorm:"'WRFACTORTYPEID'"`                   // 仓单要素类型ID
+	Deliverygoodsid         int32     `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                 // 交割商品ID
+	Brandid                 int64     `json:"brandid"  xorm:"'BRANDID'"`                                 // 品牌ID(1交割品种升贴水参数表 AutoID)
+	Qualityid               int64     `json:"qualityid"  xorm:"'QUALITYID'"`                             // 品质ID(1交割品种升贴水参数表 AutoID)
+	Specid                  int64     `json:"specid"  xorm:"'SPECID'"`                                   // 规格ID(1交割品种升贴水参数表 AutoID)
+	Warehouseid             int64     `json:"warehouseid"  xorm:"'WAREHOUSEID'"`                         // 仓库ID(1交割品种升贴水参数表 AutoID)
+	Deliverymonthid         int64     `json:"deliverymonthid"  xorm:"'DELIVERYMONTHID'"`                 // 月份ID(1交割品种升贴水参数表 AutoID)
+	Applyqty                int64     `json:"applyqty"  xorm:"'APPLYQTY'"`                               // 申请数量
+	Acutionstatus           int32     `json:"acutionstatus"  xorm:"'ACUTIONSTATUS'"`                     // 竞拍状态 - 1:竞拍中 2:未开始 3:竞拍结束(成交) 4:竞拍结束(流拍) 5:竞拍结束(履约) 6:-- 7:已注销 9:人工流拍[荷兰式]
+	Startprice              float64   `json:"startprice"  xorm:"'STARTPRICE'"`                           // 起拍价
+	Floorprice              float64   `json:"floorprice"  xorm:"'FLOORPRICE'"`                           // 底价
+	Starttradedate          string    `json:"starttradedate"  xorm:"'STARTTRADEDATE'"`                   // 起拍交易日
+	Starttime               time.Time `json:"starttime"  xorm:"'STARTTIME'"`                             // 开始时间
+	Endtime                 time.Time `json:"endtime"  xorm:"'ENDTIME'"`                                 // 结束时间
+	Margin                  float64   `json:"margin"  xorm:"'MARGIN'"`                                   // 买方保证金设置值
+	Cutinterval             int64     `json:"cutinterval"  xorm:"'CUTINTERVAL'"`                         // 降价周期 - [降价式] ;  [荷兰式]:大钟转一圈的时间
+	Pricestep               float64   `json:"pricestep"  xorm:"'PRICESTEP'"`                             // 价格幅度[降价式、竞价式]; [荷兰式]:大钟转一圈的价格,10的幂次方
+	Tradeprice              float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`                           // 成交价[结束时更新]
+	Tradeqty                int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                               // 成交数量
+	Quotenum                int64     `json:"quotenum"  xorm:"'QUOTENUM'"`                               // 出价次数[结束时更新]
+	Createtime              time.Time `json:"createtime"  xorm:"'CREATETIME'"`                           // 创建时间
+	Updatetime              time.Time `json:"updatetime"  xorm:"'UPDATETIME'"`                           // 更新时间
+	Decimalplace            int32     `json:"decimalplace"  xorm:"'DECIMALPLACE'"`                       // 报价小数位
+	Feealgorithm            int32     `json:"feealgorithm"  xorm:"'FEEALGORITHM'"`                       // 买方手续费收取方式  1:比率  2:固定
+	Exchagechargevalue      float64   `json:"exchagechargevalue"  xorm:"'EXCHAGECHARGEVALUE'"`           // 买方手续费设置值(交易所部分)
+	Feealgorithm2           int32     `json:"feealgorithm2"  xorm:"'FEEALGORITHM2'"`                     // 卖方手续费收取方式  1:比率  2:固定
+	Exchagechargevalue2     float64   `json:"exchagechargevalue2"  xorm:"'EXCHAGECHARGEVALUE2'"`         // 卖方手续费设置值(交易所部分)
+	Feealgorithm3           int32     `json:"feealgorithm3"  xorm:"'FEEALGORITHM3'"`                     // 流拍手续费收取方式  1:比率  2:固定
+	Exchagechargevalue3     float64   `json:"exchagechargevalue3"  xorm:"'EXCHAGECHARGEVALUE3'"`         // 流拍手续费设置值[收卖方,比例时按底价计算](交易所部分)
+	Failcharge              float64   `json:"failcharge"  xorm:"'FAILCHARGE'"`                           // 流拍手续费
+	Unit                    string    `json:"unit"  xorm:"'UNIT'"`                                       // 单位
+	Goodspicurl             string    `json:"goodspicurl"  xorm:"'GOODSPICURL'"`                         // 商品介绍图片(按顺序逗号分隔)
+	Buymarginalgorithm      int32     `json:"buymarginalgorithm"  xorm:"'BUYMARGINALGORITHM'"`           // 买方保证金方式 - 1:比率  2:固定
+	Sellmarginalgorithm     int32     `json:"sellmarginalgorithm"  xorm:"'SELLMARGINALGORITHM'"`         // 卖方保证金方式 - 1:比率  2:固定
+	Sellmarginvalue         float64   `json:"sellmarginvalue"  xorm:"'SELLMARGINVALUE'"`                 // 卖方保证金设置值
+	Performancemode         int32     `json:"performancemode"  xorm:"'PERFORMANCEMODE'"`                 // 履约方式 - 1:立即执行 2:履约模板执行
+	Performancetemplateid   int64     `json:"performancetemplateid"  xorm:"'PERFORMANCETEMPLATEID'"`     // 履约计划模板ID(方式为1时填-1, 为2时选择模板)
+	Sellerfreezemargin      float64   `json:"sellerfreezemargin"  xorm:"'SELLERFREEZEMARGIN'"`           // 冻结保证金-作废
+	Sellerfreezecharge      float64   `json:"sellerfreezecharge"  xorm:"'SELLERFREEZECHARGE'"`           // 冻结手续费-作废
+	Buyfirstmarginalgorithm int32     `json:"buyfirstmarginalgorithm"  xorm:"'BUYFIRSTMARGINALGORITHM'"` // 出价保证金方式 - 1:比率  2:固定
+	Buyfirstmarginvalue     float64   `json:"buyfirstmarginvalue"  xorm:"'BUYFIRSTMARGINVALUE'"`         // 出价保证金设置值
+	Auctiondesc             string    `json:"auctiondesc"  xorm:"'AUCTIONDESC'"`                         //
+	Pricemode               int32     `json:"pricemode"  xorm:"'PRICEMODE'"`                             // 价格类型 - 1:单价 2:总价 [荷兰式-单价则起拍价为单价, 总价为总价]
+	Haswr                   int32     `json:"haswr"  xorm:"'HASWR'"`                                     // 是否有仓单[荷兰式\竞价式]
+	Highestprice            float64   `json:"highestprice"  xorm:"'HIGHESTPRICE'"`                       // 最高价[竞价式]
+	Rebateratio             float64   `json:"rebateratio"  xorm:"'REBATERATIO'"`                         // 返利比率
+	Appraisal               string    `json:"appraisal"  xorm:"'APPRAISAL'"`                             //
+	Memberchargevalue       float64   `json:"memberchargevalue"  xorm:"'MEMBERCHARGEVALUE'"`             // 买方手续费设置值(会员部分)
+	Memberchargevalue2      float64   `json:"memberchargevalue2"  xorm:"'MEMBERCHARGEVALUE2'"`           // 卖方手续费设置值(会员部分)
+	Memberchargevalue3      float64   `json:"memberchargevalue3"  xorm:"'MEMBERCHARGEVALUE3'"`           // 流拍卖方手续费设置值(会员部分)
+	Performanceway          int32     `json:"performanceway"  xorm:"'PERFORMANCEWAY'"`                   // 交货模式 - 2:分步履约 3:分步提货
+	Buyreleaseratio         float64   `json:"buyreleaseratio"  xorm:"'BUYRELEASERATIO'"`                 // 买方释放比率[2:分步履约]
+	Sellreleaseratio        float64   `json:"sellreleaseratio"  xorm:"'SELLRELEASERATIO'"`               // 卖方释放比率[2:分步履约]
+	Executemode             int32     `json:"executemode"  xorm:"'EXECUTEMODE'"`                         // 执行方式[2:分步履约] - 1:顺序执行 2:交叉执行
+	Executeside             int32     `json:"executeside"  xorm:"'EXECUTESIDE'"`                         // 执行方[2:分步履约] - 1:买方 2:卖方
+	Minqty                  int32     `json:"minqty"  xorm:"'MINQTY'"`                                   // 最小执行量[2:分步履约]
+	Holddays                int32     `json:"holddays"  xorm:"'HOLDDAYS'"`                               // 合同期限[2:分步履约]
+	Marketprice             float64   `json:"marketprice"  xorm:"'MARKETPRICE'"`                         // 市场价
+	Categoryid              int32     `json:"categoryid"  xorm:"'CATEGORYID'"`                           // 类别ID(SEQ_WHZG_DGCATEGORY)
+	Shopid                  int32     `json:"shopid"  xorm:"'SHOPID'"`                                   // 店铺ID(SEQ_SZDZ2_AUCTIONSHOP)
+}
+
+// TableName is AUCTION_ORDERINFO
+func (Auctionorderinfo) TableName() string {
+	return "AUCTION_ORDERINFO"
+}

+ 23 - 0
models/deliveryModes.go

@@ -1,6 +1,29 @@
 // Package models 40.a交割服务
 package models
 
+// Deliverygoods 现货品种表
+type Deliverygoods struct {
+	Deliverygoodsid   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'" binding:"required"`     // 交割商品ID(SEQ_DELIVERYGOODS)
+	Deliverygoodscode string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'" binding:"required"` // 交割商品代码
+	Deliverygoodsname string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                    // 交割商品名称
+	Goodsunitid       int32   `json:"goodsunitid"  xorm:"'GOODSUNITID'"`                                // 交割商品单位ID
+	Deliverygoodstype int32   `json:"deliverygoodstype"  xorm:"'DELIVERYGOODSTYPE'"`                    // 交割商品类型: 1-整装不拆分 2-散装记录明细 3:整装拆分 4:散装不记录明细
+	Standardqty       int64   `json:"standardqty"  xorm:"'STANDARDQTY'"`                                // 标准数量(库位数量) [标准品特有]
+	Standardqtyrange  float64 `json:"standardqtyrange"  xorm:"'STANDARDQTYRANGE'"`                      // 标准数量偏差范围 [标准品特有]
+	Auditflag         int32   `json:"auditflag"  xorm:"'AUDITFLAG'"`                                    // 交割是否需要审核 - 0:不需要 1:需要审核   默认为0
+	Isvalid           int32   `json:"isvalid"  xorm:"'ISVALID'"`                                        // 是否有效 - 0:无效 1:有效
+	Agreeunit         int64   `json:"agreeunit"  xorm:"'AGREEUNIT'"`                                    // 合约单位[散货时默认为1, 整装时默认为标准数量]
+	Issplit           int32   `json:"issplit"  xorm:"'ISSPLIT'"`                                        // 是否拆分 - 0:不拆分 1:拆分 [整装]   0:不记录明细 1:记录明细 [散货] - 作废整装时不拆分,则标准数量=合约单位;拆分时标准数量为合约单位的整数倍;整装时必须记录明细表数据
+	Qtydecimalplace   int32   `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`                        // 成交量小数位
+	Categoryid        int32   `json:"categoryid"  xorm:"'CATEGORYID'"`                                  // 类别ID(SEQ_WRCATEGORY)
+	Dgstatus          int32   `json:"dgstatus"  xorm:"'DGSTATUS'"`                                      // 品种状态 - 作废 - 0:未激活 1:正常
+}
+
+// TableName is DELIVERYGOODS
+func (Deliverygoods) TableName() string {
+	return "DELIVERYGOODS"
+}
+
 // Deliveryrelation 商品交割关系表
 type Deliveryrelation struct {
 	Goodsid           int64   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`               // 交易合约ID

+ 8 - 0
routers/router.go

@@ -8,6 +8,7 @@ import (
 	"mtp2_if/controllers/erms2"
 	"mtp2_if/controllers/order"
 	"mtp2_if/controllers/szdz"
+	"mtp2_if/controllers/taaccount"
 	"mtp2_if/controllers/user"
 	"mtp2_if/controllers/wrtrade"
 	"mtp2_if/logger"
@@ -52,6 +53,13 @@ func InitRouter() *gin.Engine {
 		// 获取用户信息请求参数
 		userR.Use(token.Auth()).GET("/QueryUserInfo", user.QueryUserInfo)
 	}
+	// ************************ 资金账户 ************************
+	taAccountR := apiR.Group("TaAccount")
+	taAccountR.Use(token.Auth())
+	{
+		// 资金流水查询(当前)
+		taAccountR.GET("/QueryAmountLog", taaccount.QueryAmountLog)
+	}
 	// ************************ 通用服务 ************************
 	commonR := apiR.Group("Common")
 	commonR.Use()