Ver Fonte

增加“获取待付款信息”接口

zhou.xiaoning há 5 anos atrás
pai
commit
228d540bae
9 ficheiros alterados com 954 adições e 21 exclusões
  1. 4 4
      config/config.xml
  2. 38 0
      controllers/erms3/business.go
  3. 76 0
      controllers/hsby/hsby.go
  4. 258 0
      docs/docs.go
  5. 258 0
      docs/swagger.json
  6. 179 0
      docs/swagger.yaml
  7. 95 17
      models/erms3.go
  8. 42 0
      models/hsby.go
  9. 4 0
      routers/router.go

+ 4 - 4
config/config.xml

@@ -16,12 +16,12 @@
         <DbAddress value="192.168.31.117"/>
         <DbName    value="orcl"/>
         <DbPort    value="1521"/>
-        <DbUser    value="mtp2_test104"/>
+        <DbUser    value="mtp2_test82"/>
         <DbPwd     value="muchinfo"/>
     </DbSetting>
 
     <RedisSetting>
-        <Address   value="192.168.31.104"/>
+        <Address   value="192.168.30.182"/>
         <Port      value="5007"/>
         <Timeout   value="3"/>
         <ConnNum   value="1"/>
@@ -30,12 +30,12 @@
     </RedisSetting>
 
     <MqSetting>
-        <Url       value="amqp://guest:guest@192.168.31.104:5020/test"/>
+        <Url       value="amqp://guest:guest@192.168.30.182:5020/test"/>
         <Exchange  value="entry"/>
     </MqSetting>
 
     <MongoDBSetting>
-        <HostName   value="192.168.31.104"/>
+        <HostName   value="192.168.30.182"/>
         <Port       value="5025"/>
         <DBName     value="HistoryQuote"/>
         <Username   value="quote_test01"/>

+ 38 - 0
controllers/erms3/business.go

@@ -280,3 +280,41 @@ func AddErms2ASApply(c *gin.Context) {
 	logger.GetLogger().Debugf("AddErms2ASApply successed: ok")
 	appG.Response(http.StatusOK, e.SUCCESS, "ok")
 }
+
+// AddErms2SpotTradeApplyReq 新增期现套利业务申请请求参数
+type AddErms2SpotTradeApplyReq struct {
+	models.Erms2spottradeapply
+}
+
+// AddErms2SpotTradeApply 新增现货贸易业务申请
+// @Summary 新增现货贸易业务申请
+// @Produce json
+// @Security ApiKeyAuth
+// @Param jsonBody body AddErms2SpotTradeApplyReq true "申请参数"
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /Erms3/AddErms2SpotTradeApply [post]
+// @Tags 风险管理v3
+func AddErms2SpotTradeApply(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req AddErms2SpotTradeApplyReq
+	err := appG.C.ShouldBindJSON(&req)
+	if err != nil {
+		logger.GetLogger().Errorf("AddErms2SpotTradeApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 插入数据
+	if err := models.InsertErms2SpotTradeApply(req.Erms2spottradeapply); err != nil {
+		logger.GetLogger().Errorf("AddErms2SpotTradeApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
+		return
+	}
+
+	// 执行成功
+	logger.GetLogger().Debugf("AddErms2SpotTradeApply successed: ok")
+	appG.Response(http.StatusOK, e.SUCCESS, "ok")
+}

+ 76 - 0
controllers/hsby/hsby.go

@@ -851,3 +851,79 @@ func GetHsbyMyCount(c *gin.Context) {
 	logger.GetLogger().Debugln("GetHsbyMyCount successed: %v", rsp)
 	appG.Response(http.StatusOK, e.SUCCESS, rsp)
 }
+
+// QueryTradePayOrdersReq 待付款信息查询请求参数
+type QueryTradePayOrdersReq struct {
+	app.PageInfo
+	AccountIDs string `form:"accountIDs" binding:"required"`
+	BuyOrderID int    `form:"buyOrderID"`
+}
+
+// QueryTradePayOrders 获取待付款信息
+// @Summary 获取待付款信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param page query int false "页码"
+// @Param pagesize query int false "每页条数"
+// @Param accountIDs query string true "资金账户列表,格式:1,2,3"
+// @Param buyOrderID query int false "买方委托单号"
+// @Success 200 {object} models.Tradepayorder
+// @Failure 500 {object} app.Response
+// @Router /HSBY/QueryTradePayOrders [get]
+// @Tags 定制【海商报业】
+func QueryTradePayOrders(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryTradePayOrdersReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryTradePayOrders failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 获取数据
+	orders, err := models.GetTradePayOrders(req.AccountIDs, req.BuyOrderID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryTradePayOrders failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 排序
+	sort.Slice(orders, func(i int, j int) bool {
+		return orders[i].Createtime.Before(orders[j].Createtime)
+	})
+
+	// 分页
+	total := len(orders)
+	if req.PageSize > 0 {
+		rstByPage := make([]models.Tradepayorder, 0)
+		// 开始上标
+		start := req.Page * req.PageSize
+		// 结束下标
+		end := start + req.PageSize
+
+		if start <= len(orders) {
+			// 判断结束下标是否越界
+			if end > len(orders) {
+				end = len(orders)
+			}
+			rstByPage = orders[start:end]
+		} else {
+			rstByPage = orders[0:0]
+		}
+
+		orders = rstByPage
+	}
+
+	// 查询成功返回
+	if req.PageSize > 0 {
+		logger.GetLogger().Debugln("QueryTradePayOrders successed: %v", orders)
+		appG.ResponseByPage(http.StatusOK, e.SUCCESS, orders, app.PageInfo{Page: req.Page, PageSize: req.PageSize, Total: total})
+	} else {
+		logger.GetLogger().Debugln("QueryTradePayOrders successed: %v", orders)
+		appG.Response(http.StatusOK, e.SUCCESS, orders)
+	}
+}

+ 258 - 0
docs/docs.go

@@ -855,6 +855,47 @@ var doc = `{
                 }
             }
         },
+        "/Erms3/AddErms2SpotTradeApply": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "风险管理v3"
+                ],
+                "summary": "新增现货贸易业务申请",
+                "parameters": [
+                    {
+                        "description": "申请参数",
+                        "name": "jsonBody",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/erms3.AddErms2SpotTradeApplyReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Erms3/AddSpotContractApply": {
             "post": {
                 "security": [
@@ -1888,6 +1929,63 @@ var doc = `{
                 }
             }
         },
+        "/HSBY/QueryTradePayOrders": {
+            "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": "accountIDs",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "买方委托单号",
+                        "name": "buyOrderID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Tradepayorder"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/HSBY/SetHsbyMyPackagesStatus": {
             "post": {
                 "security": [
@@ -5016,6 +5114,90 @@ var doc = `{
                 }
             }
         },
+        "erms3.AddErms2SpotTradeApplyReq": {
+            "type": "object",
+            "required": [
+                "spottradeid"
+            ],
+            "properties": {
+                "applyjsondetail": {
+                    "description": "申请明细(JSON)",
+                    "type": "string"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 0:待审核 1:审核通过 2:审核中 3:审核失败 4已撤销 5:审核拒绝",
+                    "type": "integer"
+                },
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "integer"
+                },
+                "auditid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "futureaccountid": {
+                    "description": "期货资金账户",
+                    "type": "integer"
+                },
+                "goodsgroupid": {
+                    "description": "期货品种",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "spotaccountid": {
+                    "description": "现货资金账户",
+                    "type": "integer"
+                },
+                "spottradeid": {
+                    "description": "业务ID(341+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "spottradename": {
+                    "description": "业务名称",
+                    "type": "string"
+                },
+                "spottradeno": {
+                    "description": "业务编号",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "仓单标准ID",
+                    "type": "integer"
+                }
+            }
+        },
         "erms3.AddSpotContractApplyReq": {
             "type": "object",
             "required": [
@@ -7387,6 +7569,82 @@ var doc = `{
                 }
             }
         },
+        "models.Tradepayorder": {
+            "type": "object",
+            "required": [
+                "tradeid"
+            ],
+            "properties": {
+                "buyaccountid": {
+                    "description": "买方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "buyorderid": {
+                    "description": "买方委托单号",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "offamount": {
+                    "description": "优惠金额",
+                    "type": "number"
+                },
+                "payflag": {
+                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期",
+                    "type": "integer"
+                },
+                "paylimitedtime": {
+                    "description": "支付期限",
+                    "type": "string"
+                },
+                "paytime": {
+                    "description": "付款时间",
+                    "type": "string"
+                },
+                "sellaccountid": {
+                    "description": "卖方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "sellorderid": {
+                    "description": "卖方委托单号",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "成交金额",
+                    "type": "number"
+                },
+                "tradecharge": {
+                    "description": "成交手续费(买方)",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Useraccount": {
             "type": "object",
             "required": [

+ 258 - 0
docs/swagger.json

@@ -839,6 +839,47 @@
                 }
             }
         },
+        "/Erms3/AddErms2SpotTradeApply": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "风险管理v3"
+                ],
+                "summary": "新增现货贸易业务申请",
+                "parameters": [
+                    {
+                        "description": "申请参数",
+                        "name": "jsonBody",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/erms3.AddErms2SpotTradeApplyReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Erms3/AddSpotContractApply": {
             "post": {
                 "security": [
@@ -1872,6 +1913,63 @@
                 }
             }
         },
+        "/HSBY/QueryTradePayOrders": {
+            "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": "accountIDs",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "买方委托单号",
+                        "name": "buyOrderID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Tradepayorder"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/HSBY/SetHsbyMyPackagesStatus": {
             "post": {
                 "security": [
@@ -5000,6 +5098,90 @@
                 }
             }
         },
+        "erms3.AddErms2SpotTradeApplyReq": {
+            "type": "object",
+            "required": [
+                "spottradeid"
+            ],
+            "properties": {
+                "applyjsondetail": {
+                    "description": "申请明细(JSON)",
+                    "type": "string"
+                },
+                "applystatus": {
+                    "description": "申请状态 - 0:待审核 1:审核通过 2:审核中 3:审核失败 4已撤销 5:审核拒绝",
+                    "type": "integer"
+                },
+                "areauserid": {
+                    "description": "所属机构",
+                    "type": "integer"
+                },
+                "auditid": {
+                    "description": "审核人",
+                    "type": "integer"
+                },
+                "auditremark": {
+                    "description": "审核备注",
+                    "type": "string"
+                },
+                "audittime": {
+                    "description": "审核时间",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "futureaccountid": {
+                    "description": "期货资金账户",
+                    "type": "integer"
+                },
+                "goodsgroupid": {
+                    "description": "期货品种",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "spotaccountid": {
+                    "description": "现货资金账户",
+                    "type": "integer"
+                },
+                "spottradeid": {
+                    "description": "业务ID(341+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "spottradename": {
+                    "description": "业务名称",
+                    "type": "string"
+                },
+                "spottradeno": {
+                    "description": "业务编号",
+                    "type": "string"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "仓单标准ID",
+                    "type": "integer"
+                }
+            }
+        },
         "erms3.AddSpotContractApplyReq": {
             "type": "object",
             "required": [
@@ -7371,6 +7553,82 @@
                 }
             }
         },
+        "models.Tradepayorder": {
+            "type": "object",
+            "required": [
+                "tradeid"
+            ],
+            "properties": {
+                "buyaccountid": {
+                    "description": "买方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "buyorderid": {
+                    "description": "买方委托单号",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "offamount": {
+                    "description": "优惠金额",
+                    "type": "number"
+                },
+                "payflag": {
+                    "description": "付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期",
+                    "type": "integer"
+                },
+                "paylimitedtime": {
+                    "description": "支付期限",
+                    "type": "string"
+                },
+                "paytime": {
+                    "description": "付款时间",
+                    "type": "string"
+                },
+                "sellaccountid": {
+                    "description": "卖方账号ID[报价币种]",
+                    "type": "integer"
+                },
+                "sellorderid": {
+                    "description": "卖方委托单号",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "成交金额",
+                    "type": "number"
+                },
+                "tradecharge": {
+                    "description": "成交手续费(买方)",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "成交价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Useraccount": {
             "type": "object",
             "required": [

+ 179 - 0
docs/swagger.yaml

@@ -1265,6 +1265,68 @@ definitions:
     required:
     - asapplyid
     type: object
+  erms3.AddErms2SpotTradeApplyReq:
+    properties:
+      applyjsondetail:
+        description: 申请明细(JSON)
+        type: string
+      applystatus:
+        description: 申请状态 - 0:待审核 1:审核通过 2:审核中 3:审核失败 4已撤销 5:审核拒绝
+        type: integer
+      areauserid:
+        description: 所属机构
+        type: integer
+      auditid:
+        description: 审核人
+        type: integer
+      auditremark:
+        description: 审核备注
+        type: string
+      audittime:
+        description: 审核时间
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: integer
+      deliverygoodsid:
+        description: 现货品种ID
+        type: integer
+      futureaccountid:
+        description: 期货资金账户
+        type: integer
+      goodsgroupid:
+        description: 期货品种
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      spotaccountid:
+        description: 现货资金账户
+        type: integer
+      spottradeid:
+        description: 业务ID(341+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      spottradename:
+        description: 业务名称
+        type: string
+      spottradeno:
+        description: 业务编号
+        type: string
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      wrstandardid:
+        description: 仓单标准ID
+        type: integer
+    required:
+    - spottradeid
+    type: object
   erms3.AddSpotContractApplyReq:
     properties:
       accountid:
@@ -3035,6 +3097,62 @@ definitions:
     required:
     - autoid
     type: object
+  models.Tradepayorder:
+    properties:
+      buyaccountid:
+        description: 买方账号ID[报价币种]
+        type: integer
+      buyorderid:
+        description: 买方委托单号
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      offamount:
+        description: 优惠金额
+        type: number
+      payflag:
+        description: 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期
+        type: integer
+      paylimitedtime:
+        description: 支付期限
+        type: string
+      paytime:
+        description: 付款时间
+        type: string
+      sellaccountid:
+        description: 卖方账号ID[报价币种]
+        type: integer
+      sellorderid:
+        description: 卖方委托单号
+        type: string
+      tradeamount:
+        description: 成交金额
+        type: number
+      tradecharge:
+        description: 成交手续费(买方)
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeid:
+        description: 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: string
+      tradeprice:
+        description: 成交价格
+        type: number
+      tradeqty:
+        description: 成交数量
+        type: integer
+    required:
+    - tradeid
+    type: object
   models.Useraccount:
     properties:
       accountname:
@@ -5299,6 +5417,31 @@ paths:
       summary: 新增期现套利业务申请
       tags:
       - 风险管理v3
+  /Erms3/AddErms2SpotTradeApply:
+    post:
+      parameters:
+      - description: 申请参数
+        in: body
+        name: jsonBody
+        required: true
+        schema:
+          $ref: '#/definitions/erms3.AddErms2SpotTradeApplyReq'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/app.Response'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 新增现货贸易业务申请
+      tags:
+      - 风险管理v3
   /Erms3/AddSpotContractApply:
     post:
       parameters:
@@ -5949,6 +6092,42 @@ paths:
       summary: 查询省市信息(不包括区)
       tags:
       - 定制【海商报业】
+  /HSBY/QueryTradePayOrders:
+    get:
+      parameters:
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      - description: 资金账户列表,格式:1,2,3
+        in: query
+        name: accountIDs
+        required: true
+        type: string
+      - description: 买方委托单号
+        in: query
+        name: buyOrderID
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Tradepayorder'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取待付款信息
+      tags:
+      - 定制【海商报业】
   /HSBY/SetHsbyMyPackagesStatus:
     post:
       parameters:

+ 95 - 17
models/erms3.go

@@ -162,6 +162,34 @@ func (Erms2asapply) TableName() string {
 	return "ERMS2_ASAPPLY"
 }
 
+// Erms2spottradeapply 现货贸易业务申请表
+type Erms2spottradeapply struct {
+	Spottradeid     int64  `json:"spottradeid"  xorm:"'SPOTTRADEID'" binding:"required"` // 业务ID(341+Unix秒时间戳(10位)+xxxxxx)
+	Spottradeno     string `json:"spottradeno"  xorm:"'SPOTTRADENO'"`                    // 业务编号
+	Spottradename   string `json:"spottradename"  xorm:"'SPOTTRADENAME'"`                // 业务名称
+	Areauserid      int64  `json:"areauserid"  xorm:"'AREAUSERID'"`                      // 所属机构
+	Deliverygoodsid int64  `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`            // 现货品种ID
+	Wrstandardid    int64  `json:"wrstandardid"  xorm:"'WRSTANDARDID'"`                  // 仓单标准ID
+	Goodsgroupid    int32  `json:"goodsgroupid"  xorm:"'GOODSGROUPID'"`                  // 期货品种
+	Spotaccountid   int64  `json:"spotaccountid"  xorm:"'SPOTACCOUNTID'"`                // 现货资金账户
+	Futureaccountid int64  `json:"futureaccountid"  xorm:"'FUTUREACCOUNTID'"`            // 期货资金账户
+	Remark          string `json:"remark"  xorm:"'REMARK'"`                              // 备注
+	Applyjsondetail string `json:"applyjsondetail"  xorm:"'APPLYJSONDETAIL'"`            // 申请明细(JSON)
+	Applystatus     int32  `json:"applystatus"  xorm:"'APPLYSTATUS'"`                    // 申请状态 - 0:待审核 1:审核通过 2:审核中 3:审核失败 4已撤销 5:审核拒绝
+	Marketid        int64  `json:"marketid"  xorm:"'MARKETID'"`                          // 市场ID
+	Tradedate       string `json:"tradedate"  xorm:"'TRADEDATE'"`                        // 交易日(yyyyMMdd)
+	Creatorid       int64  `json:"creatorid"  xorm:"'CREATORID'"`                        // 创建人
+	Createtime      string `json:"createtime"  xorm:"'CREATETIME'"`                      // 创建时间
+	Auditid         int64  `json:"auditid"  xorm:"'AUDITID'"`                            // 审核人
+	Audittime       string `json:"audittime"  xorm:"'AUDITTIME'"`                        // 审核时间
+	Auditremark     string `json:"auditremark"  xorm:"'AUDITREMARK'"`                    // 审核备注
+}
+
+// TableName is ERMS2_SPOTTRADEAPPLY
+func (Erms2spottradeapply) TableName() string {
+	return "ERMS2_SPOTTRADEAPPLY"
+}
+
 // AddSpotContractApply 插入现货合同记录
 func AddSpotContractApply(spotContractApply Erms3SpotContractApply) error {
 	engine := db.GetEngine()
@@ -253,23 +281,23 @@ func InsertErms2AsApply(apply Erms2asapply) error {
 	}
 
 	sql := `insert into ERMS2_ASApply (
-		Asapplyid      ,
-		Asno           ,
-		Asname         ,
-		Biztype        ,
-		Userid         ,
-		Deliverygoodsid,
-		Goodsgroupid   ,
-		Spotquota      ,
-		Futurequote    ,
-		Applybasis     ,
-		Applystatus    ,
-		Remark         ,
-		Marketid       ,
-		Tradedate      ,
-		Creatorid      ,
-		Createtime     
-	) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_date(?, 'YYYY-MM-DD HH24:MI:SS'))`
+				Asapplyid      ,
+				Asno           ,
+				Asname         ,
+				Biztype        ,
+				Userid         ,
+				Deliverygoodsid,
+				Goodsgroupid   ,
+				Spotquota      ,
+				Futurequote    ,
+				Applybasis     ,
+				Applystatus    ,
+				Remark         ,
+				Marketid       ,
+				Tradedate      ,
+				Creatorid      ,
+				Createtime     
+			) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_date(?, 'YYYY-MM-DD HH24:MI:SS'))`
 	_, err = engine.Exec(sql,
 		apply.Asapplyid,
 		apply.Asno,
@@ -291,3 +319,53 @@ func InsertErms2AsApply(apply Erms2asapply) error {
 
 	return err
 }
+
+// InsertErms2SpotTradeApply 新增现货贸易业务申请
+func InsertErms2SpotTradeApply(apply Erms2spottradeapply) error {
+	engine := db.GetEngine()
+
+	// 生成ID
+	var err error
+	if apply.Spottradeid, err = GetSerialNumber("341"); err != nil {
+		return err
+	}
+
+	sql := `insert into ERMS2_SPOTTRADEAPPLY (
+				Spottradeid    ,
+				Spottradeno    ,
+				Spottradename  ,
+				Areauserid     ,
+				Deliverygoodsid,
+				Wrstandardid   ,
+				Goodsgroupid   ,
+				Spotaccountid  ,
+				Futureaccountid,
+				Remark         ,
+				Applyjsondetail,
+				Applystatus    ,
+				Marketid       ,
+				Tradedate      ,
+				Creatorid      ,
+				Createtime
+			) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_date(?, 'YYYY-MM-DD HH24:MI:SS'))`
+	_, err = engine.Exec(sql,
+		apply.Spottradeid,
+		apply.Spottradeno,
+		apply.Spottradename,
+		apply.Areauserid,
+		apply.Deliverygoodsid,
+		apply.Wrstandardid,
+		apply.Goodsgroupid,
+		apply.Spotaccountid,
+		apply.Futureaccountid,
+		apply.Remark,
+		apply.Applyjsondetail,
+		apply.Applystatus,
+		apply.Marketid,
+		apply.Tradedate,
+		apply.Creatorid,
+		time.Now().Format("2006-01-02 15:04:05"),
+	)
+
+	return err
+}

+ 42 - 0
models/hsby.go

@@ -50,6 +50,32 @@ func (Hsbysupplierinfo) TableName() string {
 	return "HSBY_SUPPLIERINFO"
 }
 
+// Tradepayorder 交易待付款表
+type Tradepayorder struct {
+	Tradeid        string    `json:"tradeid"  xorm:"'TRADEID'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradedate      string    `json:"tradedate"  xorm:"'TRADEDATE'"`                // 交易日(yyyyMMdd)
+	Marketid       int32     `json:"marketid"  xorm:"'MARKETID'"`                  // 市场ID
+	Goodsid        int32     `json:"goodsid"  xorm:"'GOODSID'"`                    // 商品ID
+	Buyorderid     string    `json:"buyorderid"  xorm:"'BUYORDERID'"`              // 买方委托单号
+	Buyaccountid   int64     `json:"buyaccountid"  xorm:"'BUYACCOUNTID'"`          // 买方账号ID[报价币种]
+	Sellorderid    string    `json:"sellorderid"  xorm:"'SELLORDERID'"`            // 卖方委托单号
+	Sellaccountid  int64     `json:"sellaccountid"  xorm:"'SELLACCOUNTID'"`        // 卖方账号ID[报价币种]
+	Tradeamount    float64   `json:"tradeamount"  xorm:"'TRADEAMOUNT'"`            // 成交金额
+	Tradecharge    float64   `json:"tradecharge"  xorm:"'TRADECHARGE'"`            // 成交手续费(买方)
+	Payflag        int32     `json:"payflag"  xorm:"'PAYFLAG'"`                    // 付款标识 - 1:未支付 2:已支付 3:已过期 4:已撤销 5:结算过期
+	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`              // 创建时间
+	Paytime        time.Time `json:"paytime"  xorm:"'PAYTIME'"`                    // 付款时间
+	Paylimitedtime time.Time `json:"paylimitedtime"  xorm:"'PAYLIMITEDTIME'"`      // 支付期限
+	Offamount      float64   `json:"offamount"  xorm:"'OFFAMOUNT'"`                // 优惠金额
+	Tradeprice     float64   `json:"tradeprice"  xorm:"'TRADEPRICE'"`              // 成交价格
+	Tradeqty       int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                  // 成交数量
+}
+
+// TableName is TRADE_PAYORDER
+func (Tradepayorder) TableName() string {
+	return "TRADE_PAYORDER"
+}
+
 // HsbyTopGoods 热卖商品(二级市场挂牌点选)
 type HsbyTopGoods struct {
 	Goodsid      int64   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID(自增ID SEQ_GOODS)
@@ -1082,3 +1108,19 @@ func GetHsbyBuyMyTradeDetails(accountIDs string) ([]HsbyBuyMyTradeDetail, error)
 
 	return orders, nil
 }
+
+// GetTradePayOrders 获取待付款信息
+func GetTradePayOrders(accountIDs string, buyOrderID int) ([]Tradepayorder, error) {
+	engine := db.GetEngine()
+
+	orders := make([]Tradepayorder, 0)
+	session := engine.Where(fmt.Sprintf("PAYFLAG = 1 and BUYACCOUNTID in (%s)", accountIDs))
+	if buyOrderID != 0 {
+		session = session.And("BUYORDERID = ?", buyOrderID)
+	}
+	if err := session.Find(&orders); err != nil {
+		return nil, err
+	}
+
+	return orders, nil
+}

+ 4 - 0
routers/router.go

@@ -206,6 +206,8 @@ func InitRouter() *gin.Engine {
 		erms3R.GET("/QueryUserInfos", erms3.QueryUserInfos)
 		// 新增期现套利业务申请
 		erms3R.POST("/AddErms2ASApply", erms3.AddErms2ASApply)
+		// 新增现货贸易业务申请
+		erms3R.POST("/AddErms2SpotTradeApply", erms3.AddErms2SpotTradeApply)
 	}
 	// ************************ 定制【尚志大宗】 ************************
 	szdzR := apiR.Group("SZDZ")
@@ -254,6 +256,8 @@ func InitRouter() *gin.Engine {
 		hsbyR.GET("/QueryHsbyBuyMyTradeDetail", hsby.QueryHsbyBuyMyTradeDetail)
 		// 获取我的订单与包裹数量
 		hsbyR.GET("/GetHsbyMyCount", hsby.GetHsbyMyCount)
+		// 获取待付款信息
+		hsbyR.GET("/QueryTradePayOrders", hsby.QueryTradePayOrders)
 	}
 
 	return r