Procházet zdrojové kódy

增加接口:
1、/Ferroalloy/QueryTHJPurchaseTransfer
查询合同转让列表
2、/Ferroalloy/QueryTHJPurchaseTransferDetail
查询合同转让详情

zhou.xiaoning před 3 roky
rodič
revize
b975303ac5

+ 89 - 3
controllers/ferroalloy/quote.go

@@ -33,10 +33,10 @@ func GetSpotGoodsPrice(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Param    userid       query    int  true  "用户ID"
 // @Param    favoriteflag query    bool false "关注标志 true-已关注 false-未关注"
-// @Param    page     query    int false "页码"
-// @Param    pagesize query    int false "每页条数"
+// @Param    page           query    int    false "页码"
+// @Param    pagesize       query    int    false "每页条数"
 // @Success  200          {array}  models.THJProduct
-// @Failure  500      {object} app.Response
+// @Failure  500            {object} app.Response
 // @Router   /Ferroalloy/QueryTHJProduct [get]
 // @Tags     铁合金
 func QueryTHJProduct(c *gin.Context) {
@@ -70,3 +70,89 @@ func QueryTHJGoodsDetail(c *gin.Context) {
 		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// QueryTHJWrstandard
+// @Summary  查询采购列表
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardname query    string false "现货商品名称(模糊查询)"
+// @Param    page           query    int    false "页码"
+// @Param    pagesize       query    int    false "每页条数"
+// @Success  200            {array}  models.THJWrstandard
+// @Failure  500            {object} app.Response
+// @Router   /Ferroalloy/QueryTHJWrstandard [get]
+// @Tags     铁合金
+func QueryTHJWrstandard(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJWrstandard{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}
+
+// QueryTHJWrstandardDetail
+// @Summary  查询采购详情
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardid query    int true "现货商品ID"
+// @Success  200          {array}  models.THJWrstandardDetailRsp
+// @Failure  500          {object} app.Response
+// @Router   /Ferroalloy/QueryTHJWrstandardDetail [get]
+// @Tags     铁合金
+func QueryTHJWrstandardDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJWrstandardDetailReq{}
+	if err := a.C.ShouldBind(&m); err != nil {
+		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if rsp, err := m.GetTHJWrstandardDetail(); err == nil {
+		a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
+	} else {
+		logger.GetLogger().Errorf("query fail, %v", err)
+		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+	}
+}
+
+// QueryTHJPurchaseTransfer
+// @Summary  查询合同转让列表
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardname query    string false "现货商品名称(模糊查询)"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
+// @Success  200            {array}  models.PurchaseTransfer
+// @Failure  500      {object} app.Response
+// @Router   /Ferroalloy/QueryTHJPurchaseTransfer [get]
+// @Tags     铁合金
+func QueryTHJPurchaseTransfer(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.PurchaseTransfer{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}
+
+// QueryTHJPurchaseTransferDetail
+// @Summary  查询合同转让详情
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardid query    int true "现货商品ID"
+// @Success  200          {array}  models.THJPurchaseTradeDetailRsp
+// @Failure  500          {object} app.Response
+// @Router   /Ferroalloy/QueryTHJPurchaseTransferDetail [get]
+// @Tags     铁合金
+func QueryTHJPurchaseTransferDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJPurchaseTradeDetailReq{}
+	if err := a.C.ShouldBind(&m); err != nil {
+		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if rsp, err := m.GetData(); err == nil {
+		a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
+	} else {
+		logger.GetLogger().Errorf("query fail, %v", err)
+		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+	}
+}

+ 3 - 49
controllers/ferroalloy/trade.go

@@ -2,67 +2,21 @@ package ferroalloy
 
 import (
 	"mtp2_if/global/app"
-	"mtp2_if/global/e"
-	"mtp2_if/logger"
 	"mtp2_if/models"
-	"net/http"
 
 	"github.com/gin-gonic/gin"
 )
 
-// QueryTHJWrstandard
-// @Summary  查询采购列表
-// @Produce  json
-// @Security ApiKeyAuth
-// @Param    wrstandardname query    string false "现货商品名称(模糊查询)"
-// @Param    page     query    int false "页码"
-// @Param    pagesize query    int false "每页条数"
-// @Success  200            {array}  models.THJWrstandard
-// @Failure  500      {object} app.Response
-// @Router   /Ferroalloy/QueryTHJWrstandard [get]
-// @Tags     铁合金
-func QueryTHJWrstandard(c *gin.Context) {
-	a := app.GinUtils{Gin: app.Gin{C: c}}
-	m := models.THJWrstandard{}
-	a.DoBindReq(&m)
-	a.DoGetDataByPage(&m)
-}
-
-// QueryTHJWrstandardDetail
-// @Summary  查询采购详情
-// @Produce  json
-// @Security ApiKeyAuth
-// @Param    wrstandardid query    int true "现货商品ID"
-// @Success  200          {array}  models.THJWrstandardDetailRsp
-// @Failure  500          {object} app.Response
-// @Router   /Ferroalloy/QueryTHJWrstandardDetail [get]
-// @Tags     铁合金
-func QueryTHJWrstandardDetail(c *gin.Context) {
-	a := app.GinUtils{Gin: app.Gin{C: c}}
-	m := models.THJWrstandardDetailReq{}
-	if err := a.C.ShouldBind(&m); err != nil {
-		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
-		return
-	}
-
-	if rsp, err := m.GetTHJWrstandardDetail(); err == nil {
-		a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
-	} else {
-		logger.GetLogger().Errorf("query fail, %v", err)
-		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
-	}
-}
-
 // QueryTHJPurchaseTradeDetail
 // @Summary  查询我的订单-采购订单
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    userid   query    int true  "用户ID"
 // @Param    type     query    int false "类型 - 0:未完成 1:已完成"
-// @Param    page           query    int    false "页码"
-// @Param    pagesize       query    int    false "每页条数"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
 // @Success  200      {array}  models.Thjpurchasetradedetail
-// @Failure  500            {object} app.Response
+// @Failure  500      {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
 // @Tags     铁合金
 func QueryTHJPurchaseTradeDetail(c *gin.Context) {

+ 262 - 0
docs/docs.go

@@ -7855,6 +7855,101 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTransfer": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询合同转让列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊查询)",
+                        "name": "wrstandardname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.PurchaseTransfer"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ferroalloy/QueryTHJPurchaseTransferDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询合同转让详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJPurchaseTradeDetailRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJScoreConfig": {
             "get": {
                 "security": [
@@ -32080,6 +32175,51 @@ const docTemplate = `{
                 }
             }
         },
+        "models.HistoryData": {
+            "type": "object",
+            "properties": {
+                "c": {
+                    "description": "收盘价",
+                    "type": "number"
+                },
+                "f": {
+                    "description": "是否补充数据",
+                    "type": "boolean"
+                },
+                "h": {
+                    "description": "最高价",
+                    "type": "number"
+                },
+                "hv": {
+                    "description": "持仓量",
+                    "type": "integer"
+                },
+                "l": {
+                    "description": "最低价",
+                    "type": "number"
+                },
+                "o": {
+                    "description": "开盘价",
+                    "type": "number"
+                },
+                "s": {
+                    "description": "结算价,日线周期(包括)以上才有",
+                    "type": "number"
+                },
+                "ts": {
+                    "description": "时间",
+                    "type": "string"
+                },
+                "tt": {
+                    "description": "总金额",
+                    "type": "number"
+                },
+                "tv": {
+                    "description": "总量(成交量)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.InternalEnableTradeDetail": {
             "type": "object",
             "required": [
@@ -34680,6 +34820,39 @@ const docTemplate = `{
                 }
             }
         },
+        "models.PurchaseTransfer": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "refgoodsid": {
+                    "description": "参考商品ID",
+                    "type": "integer"
+                },
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位ID",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.QhjAccountOutInApply": {
             "type": "object",
             "properties": {
@@ -40173,6 +40346,95 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJPurchaseTradeDetailRsp": {
+            "type": "object",
+            "properties": {
+                "deliverydate": {
+                    "description": "交割日期",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJPurchaseTradeDetail_Date"
+                    }
+                },
+                "goodsinfo": {
+                    "description": "商品信息",
+                    "$ref": "#/definitions/models.THJPurchaseTradeDetail_Goodsinfo"
+                },
+                "history": {
+                    "description": "历史价格走势(历史数据日线)",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.HistoryData"
+                    }
+                }
+            }
+        },
+        "models.THJPurchaseTradeDetail_Date": {
+            "type": "object",
+            "properties": {
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "enddate": {
+                    "description": "预售结束日期",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "摘牌价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "摘牌数量",
+                    "type": "integer"
+                },
+                "transferamount": {
+                    "description": "转让金额",
+                    "type": "number"
+                },
+                "transferid": {
+                    "description": "协议转让ID(332+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "transferprice": {
+                    "description": "转让价格",
+                    "type": "number"
+                }
+            }
+        },
+        "models.THJPurchaseTradeDetail_Goodsinfo": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "refgoodscode": {
+                    "description": "参考商品代码",
+                    "type": "string"
+                },
+                "refgoodsid": {
+                    "description": "参考商品ID",
+                    "type": "integer"
+                },
+                "unitid": {
+                    "description": "现货商品单位ID",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJSigninReq": {
             "type": "object",
             "required": [

+ 262 - 0
docs/swagger.json

@@ -7846,6 +7846,101 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTransfer": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询合同转让列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊查询)",
+                        "name": "wrstandardname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.PurchaseTransfer"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ferroalloy/QueryTHJPurchaseTransferDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询合同转让详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJPurchaseTradeDetailRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJScoreConfig": {
             "get": {
                 "security": [
@@ -32071,6 +32166,51 @@
                 }
             }
         },
+        "models.HistoryData": {
+            "type": "object",
+            "properties": {
+                "c": {
+                    "description": "收盘价",
+                    "type": "number"
+                },
+                "f": {
+                    "description": "是否补充数据",
+                    "type": "boolean"
+                },
+                "h": {
+                    "description": "最高价",
+                    "type": "number"
+                },
+                "hv": {
+                    "description": "持仓量",
+                    "type": "integer"
+                },
+                "l": {
+                    "description": "最低价",
+                    "type": "number"
+                },
+                "o": {
+                    "description": "开盘价",
+                    "type": "number"
+                },
+                "s": {
+                    "description": "结算价,日线周期(包括)以上才有",
+                    "type": "number"
+                },
+                "ts": {
+                    "description": "时间",
+                    "type": "string"
+                },
+                "tt": {
+                    "description": "总金额",
+                    "type": "number"
+                },
+                "tv": {
+                    "description": "总量(成交量)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.InternalEnableTradeDetail": {
             "type": "object",
             "required": [
@@ -34671,6 +34811,39 @@
                 }
             }
         },
+        "models.PurchaseTransfer": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "refgoodsid": {
+                    "description": "参考商品ID",
+                    "type": "integer"
+                },
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
+                },
+                "unitid": {
+                    "description": "现货商品单位ID",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.QhjAccountOutInApply": {
             "type": "object",
             "properties": {
@@ -40164,6 +40337,95 @@
                 }
             }
         },
+        "models.THJPurchaseTradeDetailRsp": {
+            "type": "object",
+            "properties": {
+                "deliverydate": {
+                    "description": "交割日期",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJPurchaseTradeDetail_Date"
+                    }
+                },
+                "goodsinfo": {
+                    "description": "商品信息",
+                    "$ref": "#/definitions/models.THJPurchaseTradeDetail_Goodsinfo"
+                },
+                "history": {
+                    "description": "历史价格走势(历史数据日线)",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.HistoryData"
+                    }
+                }
+            }
+        },
+        "models.THJPurchaseTradeDetail_Date": {
+            "type": "object",
+            "properties": {
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "enddate": {
+                    "description": "预售结束日期",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "摘牌价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "摘牌数量",
+                    "type": "integer"
+                },
+                "transferamount": {
+                    "description": "转让金额",
+                    "type": "number"
+                },
+                "transferid": {
+                    "description": "协议转让ID(332+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "transferprice": {
+                    "description": "转让价格",
+                    "type": "number"
+                }
+            }
+        },
+        "models.THJPurchaseTradeDetail_Goodsinfo": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "refgoodscode": {
+                    "description": "参考商品代码",
+                    "type": "string"
+                },
+                "refgoodsid": {
+                    "description": "参考商品ID",
+                    "type": "integer"
+                },
+                "unitid": {
+                    "description": "现货商品单位ID",
+                    "type": "integer"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJSigninReq": {
             "type": "object",
             "required": [

+ 180 - 0
docs/swagger.yaml

@@ -10865,6 +10865,39 @@ definitions:
     required:
     - accountid
     type: object
+  models.HistoryData:
+    properties:
+      c:
+        description: 收盘价
+        type: number
+      f:
+        description: 是否补充数据
+        type: boolean
+      h:
+        description: 最高价
+        type: number
+      hv:
+        description: 持仓量
+        type: integer
+      l:
+        description: 最低价
+        type: number
+      o:
+        description: 开盘价
+        type: number
+      s:
+        description: 结算价,日线周期(包括)以上才有
+        type: number
+      ts:
+        description: 时间
+        type: string
+      tt:
+        description: 总金额
+        type: number
+      tv:
+        description: 总量(成交量)
+        type: integer
+    type: object
   models.InternalEnableTradeDetail:
     properties:
       agreeunit:
@@ -12769,6 +12802,30 @@ definitions:
         description: 成交交易日(yyyyMMdd)
         type: string
     type: object
+  models.PurchaseTransfer:
+    properties:
+      pictureurls:
+        description: 详情图片(逗号分隔)
+        type: string
+      refgoodsid:
+        description: 参考商品ID
+        type: integer
+      thumurls:
+        description: 缩略图片(1:1)(逗号分隔)
+        type: string
+      unitid:
+        description: 现货商品单位ID
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID(自增 SEQ_GOODS 确保不重复)
+        type: integer
+      wrstandardname:
+        description: 现货商品名称(模糊查询)
+        type: string
+    type: object
   models.QhjAccountOutInApply:
     properties:
       accountcode:
@@ -16845,6 +16902,70 @@ definitions:
         description: 现货商品名称
         type: string
     type: object
+  models.THJPurchaseTradeDetail_Date:
+    properties:
+      depositrate:
+        description: 定金比例
+        type: number
+      enddate:
+        description: 预售结束日期
+        type: string
+      tradeprice:
+        description: 摘牌价格
+        type: number
+      tradeqty:
+        description: 摘牌数量
+        type: integer
+      transferamount:
+        description: 转让金额
+        type: number
+      transferid:
+        description: 协议转让ID(332+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      transferprice:
+        description: 转让价格
+        type: number
+    type: object
+  models.THJPurchaseTradeDetail_Goodsinfo:
+    properties:
+      pictureurls:
+        description: 详情图片(逗号分隔)
+        type: string
+      refgoodscode:
+        description: 参考商品代码
+        type: string
+      refgoodsid:
+        description: 参考商品ID
+        type: integer
+      unitid:
+        description: 现货商品单位ID
+        type: integer
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID(自增 SEQ_GOODS 确保不重复)
+        type: integer
+      wrstandardname:
+        description: 现货商品名称(模糊查询)
+        type: string
+    type: object
+  models.THJPurchaseTradeDetailRsp:
+    properties:
+      deliverydate:
+        description: 交割日期
+        items:
+          $ref: '#/definitions/models.THJPurchaseTradeDetail_Date'
+        type: array
+      goodsinfo:
+        $ref: '#/definitions/models.THJPurchaseTradeDetail_Goodsinfo'
+        description: 商品信息
+      history:
+        description: 历史价格走势(历史数据日线)
+        items:
+          $ref: '#/definitions/models.HistoryData'
+        type: array
+    type: object
   models.THJSigninReq:
     properties:
       userid:
@@ -28815,6 +28936,65 @@ paths:
       summary: 查询我的订单-采购订单
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJPurchaseTransfer:
+    get:
+      parameters:
+      - description: 现货商品名称(模糊查询)
+        in: query
+        name: wrstandardname
+        type: string
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.PurchaseTransfer'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询合同转让列表
+      tags:
+      - 铁合金
+  /Ferroalloy/QueryTHJPurchaseTransferDetail:
+    get:
+      parameters:
+      - description: 现货商品ID
+        in: query
+        name: wrstandardid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.THJPurchaseTradeDetailRsp'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询合同转让详情
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJScoreConfig:
     get:
       parameters:

+ 179 - 0
models/ferroalloy.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"mtp2_if/db"
 	"mtp2_if/logger"
+	"mtp2_if/mtpcache"
 	"mtp2_if/utils"
 	"strconv"
 	"strings"
@@ -1020,3 +1021,181 @@ func (r *THJGoodsDetailReq) GetTHJGoodsDetail() (rsp *THJGoodsDetailRsp, err err
 
 	return
 }
+
+type PurchaseTransfer struct {
+	WRSTANDARDID   int64  `json:"wrstandardid" xorm:"WRSTANDARDID"`                           // 现货商品ID(自增 SEQ_GOODS 确保不重复)
+	WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE"`                       // 现货商品代码
+	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME" form:"wrstandardname"` // 现货商品名称(模糊查询)
+	UNITID         int32  `json:"unitid" xorm:"UNITID"`                                       // 现货商品单位ID
+	THUMURLS       string `json:"thumurls" xorm:"THUMURLS"`                                   // 缩略图片(1:1)(逗号分隔)
+	PICTUREURLS    string `json:"pictureurls" xorm:"PICTUREURLS"`                             // 详情图片(逗号分隔)
+	REFGOODSID     int64  `json:"refgoodsid" xorm:"REFGOODSID"`                               // 参考商品ID
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *PurchaseTransfer) calc() {
+
+}
+
+func (r *PurchaseTransfer) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.WRSTANDARDID  ,
+		t.WRSTANDARDCODE,
+		t.WRSTANDARDNAME,
+		t.UNITID        ,
+		t.THUMURLS      ,
+		t.PICTUREURLS   ,
+		t.REFGOODSID    
+  	from wrstandard wr
+	where wr.wrstandardid in (
+		select td.wrstandardid
+        from THJ_PurchaseTransfer t
+        inner join THJ_PurchaseTradeDetail td on t.wrtradedetailid = td.wrtradedetailid
+         where t.TransferStatus = 1)
+   	and %v 
+	order by wr.wrstandardname
+`
+	param := "1=1"
+	if r.WRSTANDARDNAME != "" {
+		param = fmt.Sprintf("wr.wrstandardname like '%%%v%%'", r.WRSTANDARDNAME)
+	}
+	sqlId.FormatParam(param)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *PurchaseTransfer) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]PurchaseTransfer, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}
+
+type THJPurchaseTradeDetail_Goodsinfo struct {
+	WRSTANDARDID   int64  `json:"wrstandardid" xorm:"WRSTANDARDID"`                           // 现货商品ID(自增 SEQ_GOODS 确保不重复)
+	WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE"`                       // 现货商品代码
+	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME" form:"wrstandardname"` // 现货商品名称(模糊查询)
+	UNITID         int32  `json:"unitid" xorm:"UNITID"`                                       // 现货商品单位ID
+	PICTUREURLS    string `json:"pictureurls" xorm:"PICTUREURLS"`                             // 详情图片(逗号分隔)
+	REFGOODSID     int64  `json:"refgoodsid" xorm:"REFGOODSID"`                               // 参考商品ID
+	REFGOODSCODE   string `json:"refgoodscode" xorm:"REFGOODSCODE"`                           // 参考商品代码
+}
+
+type THJPurchaseTradeDetail_Date struct {
+	ENDDATE string `json:"enddate" xorm:"ENDDATE"` // 预售结束日期
+
+	DEPOSITRATE float64 `json:"depositrate" xorm:"DEPOSITRATE"` // 定金比例
+	TRADEPRICE  float64 `json:"tradeprice" xorm:"TRADEPRICE"`   // 摘牌价格
+	TRADEQTY    int64   `json:"tradeqty" xorm:"TRADEQTY"`       // 摘牌数量
+
+	TRANSFERID     int64   `json:"transferid" xorm:"TRANSFERID"`         // 协议转让ID(332+Unix秒时间戳(10位)+xxxxxx)
+	TRANSFERPRICE  float64 `json:"transferprice" xorm:"TRANSFERPRICE"`   // 转让价格
+	TRANSFERAMOUNT float64 `json:"transferamount" xorm:"TRANSFERAMOUNT"` // 转让金额
+}
+
+type HistoryData struct {
+	Opened        float64   `json:"o"`  // 开盘价
+	Highest       float64   `json:"h"`  // 最高价
+	Lowest        float64   `json:"l"`  // 最低价
+	Closed        float64   `json:"c"`  // 收盘价
+	TotleVolume   int       `json:"tv"` // 总量(成交量)
+	TotleTurnover float64   `json:"tt"` // 总金额
+	HoldVolume    int       `json:"hv"` // 持仓量
+	Settle        float64   `json:"s"`  // 结算价,日线周期(包括)以上才有
+	TimeStamp     time.Time `json:"ts"` // 时间
+	IsFill        bool      `json:"f"`  // 是否补充数据
+}
+
+type THJPurchaseTradeDetailReq struct {
+	WRSTANDARDID int64 `form:"wrstandardid" binding:"required"` // 现货商品ID
+}
+
+// THJPurchaseTradeDetailRsp 合同转让详情
+type THJPurchaseTradeDetailRsp struct {
+	GoodsInfo     THJPurchaseTradeDetail_Goodsinfo `json:"goodsinfo"`    // 商品信息
+	DeliveryDates []THJPurchaseTradeDetail_Date    `json:"deliverydate"` // 交割日期
+	History       []HistoryData                    `json:"history"`      // 历史价格走势(历史数据日线)
+}
+
+// GetTHJWrstandardDetail 获取采购商品详情
+func (r *THJPurchaseTradeDetailReq) GetData() (rsp *THJPurchaseTradeDetailRsp, err error) {
+	engine := db.GetEngine()
+
+	rsp = new(THJPurchaseTradeDetailRsp)
+
+	// 采购商品信息
+	var goodsInfo THJPurchaseTradeDetail_Goodsinfo
+	sql := fmt.Sprintf(`
+		select 
+			t.WRSTANDARDID  ,
+			t.WRSTANDARDCODE,
+			t.WRSTANDARDNAME,
+			t.UNITID        ,
+			t.PICTUREURLS   ,
+			t.REFGOODSID    ,
+			t.REFGOODSCODE
+		from wrstandard wr
+		where wr.wrstandardid = %v
+	`, r.WRSTANDARDID)
+	if _, err = engine.SQL(sql).Get(&goodsInfo); err != nil {
+		return
+	}
+	rsp.GoodsInfo = goodsInfo
+
+	// 交割日期
+	deliveryDates := make([]THJPurchaseTradeDetail_Date, 0)
+	sql = fmt.Sprintf(`
+	select 
+		pi.ENDDATE,
+		td.DEPOSITRATE,
+		td.TRADEPRICE,
+		td.TRADEQTY,
+		t.TRANSFERPRICE,
+		t.TRANSFERAMOUNT,
+		wr.REFGOODSID,
+		t.TRANSFERID
+	from THJ_PurchaseTransfer t
+	inner join THJ_PurchaseTradeDetail td on t.wrtradedetailid = td.wrtradedetailid
+	inner join WR_PresaleInfo pi on t.presaleapplyid = pi.presaleapplyid
+	inner join wrstandard wr on wr.wrstandardid = td.wrstandardid
+	where td.wrstandardid = %v
+	`, r.WRSTANDARDID)
+	if err = engine.SQL(sql).Find(&deliveryDates); err != nil {
+		return
+	}
+	rsp.DeliveryDates = deliveryDates
+
+	// 历史价格走势
+	cycleDatas, err := GetHistoryCycleDatas(CycleTypeMinutesDay, goodsInfo.REFGOODSCODE, nil, nil, 50, false)
+	if err != nil {
+		return
+	}
+	// 获取目标商品报价小数位
+	dcplace := mtpcache.GetGoodsDecimalplace(goodsInfo.REFGOODSCODE)
+	// 计算最终价格
+	rst := make([]HistoryData, 0)
+	for _, v := range cycleDatas {
+		historyData := HistoryData{
+			Opened:        utils.IntToFloat64(v.Open, dcplace),
+			Highest:       utils.IntToFloat64(v.High, dcplace),
+			Lowest:        utils.IntToFloat64(v.Low, dcplace),
+			Closed:        utils.IntToFloat64(v.Close, dcplace),
+			TotleVolume:   v.TV,
+			TotleTurnover: float64(v.TT),
+			HoldVolume:    v.HV,
+			Settle:        utils.IntToFloat64(v.SP, dcplace),
+			TimeStamp:     time.Unix(int64(v.ST), 0),
+		}
+		rst = append(rst, historyData)
+	}
+	rsp.History = rst
+
+	return
+}

+ 2 - 0
routers/router.go

@@ -702,6 +702,8 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJProduct", ferroalloy.QueryTHJProduct)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJTradeData", ferroalloy.QueryTHJTradeData)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJGoodsDetail", ferroalloy.QueryTHJGoodsDetail)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTransfer", ferroalloy.QueryTHJPurchaseTransfer)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTransferDetail", ferroalloy.QueryTHJPurchaseTransferDetail)
 	}
 
 	return r